> ## Documentation Index
> Fetch the complete documentation index at: https://docs.antryk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Object Metadata

Retrieve metadata for an object in Antryk storage.

<CodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url "https://storage.apis.antryk.com/api/v1/buckets/:yourBucketName/metadata/:yourFilePath" \
    --header "x-access-key: YOUR_ACCESS_KEY" \
    --header "x-secret-key: YOUR_SECRET_KEY"
  ```

  ```javascript JavaScript theme={null}
  fetch(
    "https://storage.apis.antryk.com/api/v1/buckets/:yourBucketName/metadata/:yourFilePath",
    {
      method: "GET",
      headers: {
        "x-access-key": "YOUR_ACCESS_KEY",
        "x-secret-key": "YOUR_SECRET_KEY",
      },
    },
  );
  ```

  ```javascript NodeJs theme={null}
  // npm i @antryk/sdk
  import { AntrykClient } from "@antryk/sdk";

  const client = new AntrykClient({
    accessKey: process.env.ANTRYK_ACCESS_KEY,
    secretKey: process.env.ANTRYK_SECRET_KEY,
  });

  async function getMetadata() {
    const result = await client.storage.metadata({
      bucket: "upload-final-v1",
      key: "tutorial/fastapi-demo.mp4",
    });

    console.log(result.data);
  }

  getMetadata();
  ```

  ```python Python theme={null}
  # pip install requests
  import requests

  url = "https://storage.apis.antryk.com/api/v1/buckets/:yourBucketName/metadata/:yourFilePath"

  headers = {
      "x-access-key": "YOUR_ACCESS_KEY",
      "x-secret-key": "YOUR_SECRET_KEY"
  }

  response = requests.get(url, headers=headers)

  print(response.status_code)
  print(response.json())
  ```
</CodeGroup>

<Note>
  For Node.js applications, it is recommended to use the official
  [`@antryk/sdk`](https://www.npmjs.com/package/@antryk/sdk). The SDK simplifies
  metadata retrieval by handling authentication, validation, and API
  communication internally.
</Note>

<Note>
  This endpoint does **not** accept a request body. All required information
  such as bucket name and object path must be passed via the URL, while
  authentication must be provided using headers.
</Note>

### New Metadata Retrieval Approach (Recommended)

This is the recommended and modern approach for retrieving object metadata from Antryk Storage:

* No request body is required.
* The bucket name and object path are defined directly in the URL.
* Authentication is handled via headers:
  * x-access-key
  * x-secret-key

This approach improves API readability, enhances security, and aligns with RESTful API best practices.

<Note>
  ⚠️ The older approach (sending `bucket`, `key`, `accessKey`, and `secretKey`
  in the request body) may still be supported for backward compatibility, but it
  is **strongly recommended to migrate to this new method**.
</Note>

## Request Parameters

<ParamField path="yourBucketName" type="string" required>
  The name of the storage bucket. This is specified directly in the URL.
</ParamField>

<ParamField path="yourFilePath" type="string" required>
  The full path (including filename) of the object whose metadata you want to
  retrieve.
</ParamField>

<ParamField header="x-access-key" type="string" required>
  Your Antryk access key used for authentication. You can obtain this from the
  Antryk Console.
</ParamField>

<ParamField header="x-secret-key" type="string" required>
  Your Antryk secret key used for authentication. Keep this secure and never
  expose it publicly.
</ParamField>

## Examples

<ParamField path="yourBucketName" type="string" required>
  **Example:** `dsds`
</ParamField>

<ParamField path="yourFilePath" type="string" required>
  **Example:** `tutorial/fastapi-demo.mp4`
</ParamField>

<ParamField header="x-access-key" type="string" required>
  **Example:** `YOUR_ACCESS_KEY`
</ParamField>

<ParamField header="x-secret-key" type="string" required>
  **Example:** `YOUR_SECRET_KEY`
</ParamField>

<Note>
  ### Additional Notes

  * Metadata includes important details such as file size, MIME type, and last modified timestamp.
  * This endpoint is useful for validating file uploads, auditing storage usage, or displaying file information in applications.
  * Ensure the file path is correct and includes the full directory structure.
  * If the object does not exist, the API may return an error.
  * When using the SDK, all inputs are validated before making the request, improving reliability.
</Note>

## Response

Returns a JSON object containing the object metadata.

```json theme={null}
{
    "success": true,
    "message": "File exists",
    "data": {
        "key": "tutorial/fastapi-demo.mp4",
        "contentType": "video/mp4",
        "contentLength": 34270609,
        "lastModified": "2026-04-28T20:07:17.000Z"
    }
}
```
