GET
/
studio
/
v1
/
library
/
files
import requests

url = "https://api.ai21.com/studio/v1/library/files"

payload = {
    "name": "<string>",
    "path": "<string>",
    "status": "<string>",
    "label": ["<string>"],
    "Pagination": {
        "offset": 123,
        "limit": 123
    }
}
headers = {"Content-Type": "application/json"}

response = requests.request("GET", url, json=payload, headers=headers)

print(response.text)

When specifying qualifiers with your request, only files that match all qualifiers will be returned. For example, if you specify label='financial' and status='UPLOADED', only files with the label ‘financial’ and status ‘UPLOADED’ will be returned.

Request path parameters

The following optional parameters can be used to filter your results.

name
string

The full name of the uploaded file, without any path parameters. So: “mydoc.txt”, not “/users/benfranklyn/Documents/mydoc.txt”. Does not match name substrings, so “doc.txt” does not match “mydoc.txt”.

path
string

Return only files with a path value that is a full match or starts with this string. So specifying “financial/” will match documents with “financial/taxes” but not documents with “money/financial/taxes”.

status
string

Status of the file in the library. Supported values:

  • DB_RECORD_CREATED
  • UPLOADED
  • UPLOAD_FAILED
  • PROCESSED
  • PROCESSING_FAILED
label
string[]

Return only files with this label. Label matching is case-sensitive, and will not match substrings.

Pagination
object

By default, the endpoint returns up to 10000 files. Pagination can be controlled using the following parameters:

Responses

Response 200

A successful response returns an array of file metadata items.

import requests

url = "https://api.ai21.com/studio/v1/library/files"

payload = {
    "name": "<string>",
    "path": "<string>",
    "status": "<string>",
    "label": ["<string>"],
    "Pagination": {
        "offset": 123,
        "limit": 123
    }
}
headers = {"Content-Type": "application/json"}

response = requests.request("GET", url, json=payload, headers=headers)

print(response.text)