Create a file relation

Links an existing file to a business entity (e.g., an invoice, message, or meeting). The referenced file must already exist and must not be infected, failed, or deleted; linking is allowed while the file is still processing ('pending', 'scanning') as well as once ready ('scanned', 'uploaded', 'linked'). If the file is later found infected or fails processing, any relation created for it is retracted. Once a file has at least one active relation its status becomes 'linked', protecting it from cleanup.

The caller must have access to the related entity: a Staff token is checked directly against the entity. A Client token is checked by querying the client's own activity on that entity — the entity must appear in the client's activity feed (matched by message text for entity_type='message', or by activity type for every other entity type). Any error or timeout from that check is treated as no access (fails closed).

For Client tokens, the client_uid is derived from the token and any value supplied in the body is ignored. For Staff tokens, client_uid may be provided to associate the relation with a specific client; omitting it returns a 400.

Available for Staff and Client tokens.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params
string
required

Unique identifier of the file to link (e.g., "file_123abc"). Must reference an existing file that is not infected, failed, or deleted; linking is allowed while the file is still processing ('pending', 'scanning') as well as once ready ('scanned', 'uploaded', 'linked').

string
enum
required

Type of entity the file is linked to (e.g., "message", "invoice").

Allowed:
string
required

Unique identifier of the entity the file is linked to (e.g., "inv_123abc").

string

Client UID to associate with the relation (e.g., "client_789abc"). Required for Staff tokens (omitting it returns a 400 CLIENT_UID_REQUIRED); ignored for Client tokens, where it is derived from the token instead.

Responses

Language
Credentials
Bearer
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json