Skip to main content
POST
/
v2
/
files
/
search
Search Files by Keyword
curl --request POST \
  --url https://api.affinity.co/v2/files/search \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "<string>",
  "fileIds": [
    1073741824
  ],
  "limit": 20
}
'
{
  "data": [
    {
      "file": {
        "id": 1073741824,
        "name": "<string>"
      },
      "pageNumber": 5000,
      "preview": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Search all files in the org, or limit to specific file IDs.

prompt
string
required

The search query. Returns up to limit files ordered by relevance. Prompts with no strong matches may still return low-relevance results.

Required string length: 3 - 500
Example:

"revenue projections pitch deck"

fileIds
integer<int32>[]

Limit search to these specific files. Omit for org-wide search.

Maximum array length: 100
Required range: 1 <= x <= 2147483647
Example:
[1, 2]
limit
integer<int32>
default:20

Maximum number of files to return.

Required range: 1 <= x <= 100

Response

Created

Results of a keyword search over files.

data
files.SearchResult · object[]
required

Matching file results, one per file, ordered by relevance.

Maximum array length: 100