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

# Get a list of files

GET https://api.airtop.ai/api/v1/files

Get a list of files filtered by session ID

Reference: https://docs.airtop.ai/api-reference/airtop-api/files/list

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Query parameters

- `sessionIds` (string, optional) — A comma-separated list of IDs of the sessionId of the files to retrieve.
- `offset` (long, optional, default: -1) — Offset for pagination.
- `limit` (long, optional, default: 10) — Limit for pagination.

## Response

### 200

OK

- `data` (FilesWithPagination, required)
- `meta` (EnvelopeDefaultMeta, required)
- `errors` (list of Issue, optional)
- `warnings` (list of Issue, optional)

## Types

### FilesWithPagination

- `pagination` (Pagination, required) — Pagination details.
- `files` (list of ExternalFile, optional) — List of files.

### EnvelopeDefaultMeta

- `requestId` (string, optional)

### Issue

- `message` (string, required) — Message describing the issue.
- `code` (string, optional) — Issue code.
- `details` (map from string to any, optional) — Any associated details.
- `reason` (string, optional) — Underlying reason for the issue.

### Pagination

- `currentLimit` (long, required) — The number of items to return
- `currentPage` (long, required) — The current page number
- `finalCount` (long, required) — The final count of items displayed on the current page
- `hasMore` (boolean, required) — Whether there are more items
- `initialCount` (long, required) — The initial count of items displayed on the current page
- `nextOffset` (long, required) — The number of items to skip
- `numberOfPages` (long, required) — The total number of pages
- `totalItems` (long, required) — The total number of items

### ExternalFile

- `deleted` (boolean, required) — Whether the file has been deleted
- `fileBytes` (long, required) — Size of the file in bytes
- `fileName` (string, required) — Name of the file
- `fileType` (string, required) — Type of the file
- `id` (string, required) — ID of the file
- `orgId` (string, required) — ID of the organization
- `status` (string, required) — Status of the file
- `uploadStartTime` (datetime, required) — Time when the file was uploaded
- `visibleInApi` (boolean, required) — Whether the file is visible in the API
- `visibleInPortal` (boolean, required) — Whether the file is visible in the portal
- `deletionTime` (datetime, optional) — Time when the file was deleted
- `expiryTime` (datetime, optional) — Time when the file will be deleted
- `lastHeartbeatTime` (datetime, optional) — Time when the file was last heartbeated
- `sessionIds` (list of string, optional) — IDs of the associated sessions
- `uploadCompleteTime` (datetime, optional) — Time when the file was uploaded

## Examples

**Response**

```json
{
  "data": {
    "pagination": {
      "currentLimit": 1000000,
      "currentPage": 1000000,
      "finalCount": 1000000,
      "hasMore": true,
      "initialCount": 1000000,
      "nextOffset": 1000000,
      "numberOfPages": 1000000,
      "totalItems": 1000000
    },
    "files": [
      {
        "deleted": true,
        "fileBytes": 1000000,
        "fileName": "fileName",
        "fileType": "fileType",
        "id": "id",
        "orgId": "orgId",
        "status": "status",
        "uploadStartTime": "2024-01-15T09:30:00Z",
        "visibleInApi": true,
        "visibleInPortal": true
      }
    ]
  },
  "meta": {
    "requestId": "requestId"
  },
  "errors": [
    {
      "message": "message",
      "code": "code",
      "details": {
        "key": "value"
      },
      "reason": "reason"
    }
  ],
  "warnings": [
    {
      "message": "message",
      "code": "code",
      "details": {
        "key": "value"
      },
      "reason": "reason"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.airtop.ai/api/v1/files"

querystring = {"offset":"1","limit":"10"}

headers = {"Authorization": "Bearer <apiKey>"}

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

print(response.json())
```

```typescript
import { AirtopClient } from "@airtop/sdk";

const client = new AirtopClient({ apiKey: "YOUR_API_KEY" });
await client.files.list({
    offset: 1,
    limit: 10
});

```

```go
package main

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

func main() {

	url := "https://api.airtop.ai/api/v1/files?offset=1&limit=10"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <apiKey>")

	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://api.airtop.ai/api/v1/files?offset=1&limit=10")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <apiKey>'

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.get("https://api.airtop.ai/api/v1/files?offset=1&limit=10")
  .header("Authorization", "Bearer <apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.airtop.ai/api/v1/files?offset=1&limit=10', [
  'headers' => [
    'Authorization' => 'Bearer <apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.airtop.ai/api/v1/files?offset=1&limit=10");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.airtop.ai/api/v1/files?offset=1&limit=10")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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()
```