> ## 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 Objects 

Retrieve a list of objects (files and folders) from a specific directory in Antryk Storage.

This endpoint allows you to fetch all files and subfolders داخل a given path within a bucket. It is commonly used to browse directories, build file explorers, or manage stored content programmatically.

By defining the bucket name and directory path directly in the URL, this API follows a clean and RESTful design with no request body required.

<CodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url "https://storage.apis.antryk.com/api/v1/buckets/:yourBucketName/objects/:keyOrFilePath" \
    --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/objects/:keyOrFilePath",
    {
      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 listObjects() {
    const result = await client.storage.get({
      bucket: "upload-final-v1",
      key: "tutorial/docs",
    });

    console.log(result.data);
  }

  listObjects();
  ```

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

  url = "https://storage.apis.antryk.com/api/v1/buckets/:yourBucketName/objects/:keyOrFilePath"

  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
  object listing 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 directory path must be passed via the URL, while
  authentication must be provided using headers.
</Note>

### New Object Listing Approach (Recommended)

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

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

This approach simplifies integration, improves readability, and aligns with RESTful API standards.

<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="keyOrFilePath" type="string" required>
  The directory path whose contents you want to retrieve. This can represent a
  folder or prefix inside the bucket.
</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="keyOrFilePath" type="string" required>
  **Example:** `tutorial/docs`
</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

  * This endpoint returns both files and folders within the specified path.
  * Use / or an empty path (depending on implementation) to list root-level objects.
  * Useful for building file managers, dashboards, or content browsers.
  * Ensure the directory path is correctly structured to avoid unexpected results.
  * When using the SDK, inputs are validated before making requests, improving reliability and developer experience.
</Note>

## Response

Returns a JSON object containing the list of objects within the specified directory.

```json theme={null}
{
  "success": true,
  "data": [
    {
      "key": "tutorial/docs/file1.pdf",
      "size": 204800,
      "contentType": "application/pdf"
    },
    {
      "key": "tutorial/docs/image.png",
      "size": 102400,
      "contentType": "image/png"
    }
  ]
}
```
