> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.instabase.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.instabase.com/_mcp/server.

# Read file or folder metadata

HEAD https://aihub.instabase.com/api/v2/files/{path}

Read metadata of a file or folder at the target path.This API operation reports whether the object at the target path is a file or folder. If a file, it also reports the file size and last modification time.This acts on files and folders in the AI Hub filesystem, not your local filesystem.Ensure the path is accessible within the context defined by the `IB-Context` header.

Reference: https://docs.instabase.com/api-sdk/api-reference/files/get-file-metadata

## Authentication

- `Authorization` header (bearer token, required) — Bearer HTTP authentication.

## Request

### Path parameters

- `path` (string, required) — Full path to the file or folder.

### Headers

- `IB-Context` (string, optional) — Typically your organization ID. See [Authorization and context identification](/api-sdk/authorization#ib-context-header) for details.
- `IB-Retry-Config` (string, optional) — Configures retry logic if no file or folder is found at the target path. Uses a constant backoff algorithm. Don't retry if this header isn't provided. Example: `{'retries': 3, 'backoff-seconds': 5}`

## Response

### 200

Successfully retrieved metadata.

## Errors

### 404 Not Found Error

No file or folder was found at the target path.

- `any`

## Examples

**Request**

```json
{}
```

**Response**

```json
{}
```

**SDK Code**

```python with SDK
from aihub import AIHub

client = AIHub(
    api_root="https://aihub.instabase.com/api",
    api_key="abcdefghijklmnopqrst1234567890",
    ib_context="john.doe_acme.com"
)

organization_id = "acme_org"
workspace = "MyWorkspace"
drive = "Instabase Drive"
folder = "MyFolder"
node = "hello.txt"
node_path = f"{organization_id}/{workspace}/fs/{drive}/{folder}/{node}"

# returns an object with status code and headers
response = client.files.get_file_metadata(path=node_path)

is_file = (response.headers["Content-Type"] == "application/octet-stream")
is_folder = (response.headers["Content-Type"] == "application/json")

if is_file:
    file_length = response.headers["Content-Length"]
    last_modified = response.headers["last-modified"]
    print(f"Node is a file with length {file_length} and modification date {last_modified}")
else:
    print("Node is a folder")

```

```python without SDK
import requests

organization_id = "acme_org"
workspace = "MyWorkspace"
drive = "Instabase Drive"
folder = "MyFolder"
file_name = "hello.txt"
node_path = f"{organization_id}/{workspace}/fs/{drive}/{folder}/{file_name}"

url = f"https://aihub.instabase.com/api/v2/files/{node_path}"

headers = {
    "Authorization": "Bearer abcdefghijklmnopqrst1234567890",
    "IB-Context": "john.doe_acme.com"
}

# make the HEAD request
response = requests.head(url, headers=headers)

# handle the response
if response.status_code == 200:
    is_file = (response.headers["Content-Type"] == "application/octet-stream")
    is_folder = (response.headers["Content-Type"] == "application/json")

    if is_file:
        file_length = response.headers["Content-Length"]
        last_modified = response.headers["last-modified"]
        print(f"Node is a file with length {file_length} and modification date {last_modified}")
    else:
        print("Node is a folder")
else:
    print(f"Error: {response.status_code} - {response.text}")

```

```javascript
const url = 'https://aihub.instabase.com/api/v2/files/path';
const options = {
  method: 'HEAD',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://aihub.instabase.com/api/v2/files/path"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("HEAD", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://aihub.instabase.com/api/v2/files/path")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Head.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.head("https://aihub.instabase.com/api/v2/files/path")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('HEAD', 'https://aihub.instabase.com/api/v2/files/path', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://aihub.instabase.com/api/v2/files/path");
var request = new RestRequest(Method.HEAD);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://aihub.instabase.com/api/v2/files/path")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "HEAD"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```