Skip to main content
POST
Upload a File

Authorizations

Authorization
string
header
required

A static Affinity API key, presented as a bearer token.

Body

multipart/form-data

A file to upload, sent as multipart/form-data. Attach the file to exactly one of person, company, or opportunity.

fileBinary
file
required

The file content. The file must be 100 MB or smaller, and its extension and content type must be in the list of accepted file types.

person
PersonReference · object

The person to attach the file to, sent as the person[id] form field.

company
CompanyReference · object

The company to attach the file to, sent as the company[id] form field.

opportunity
OpportunityReference · object

The opportunity to attach the file to, sent as the opportunity[id] form field.

Response

Created

A file uploaded to a company, person, opportunity, or the organization directly.

id
integer<int32>
required

The file's unique identifier

Required range: 1 <= x <= 2147483647
Example:

1

name
string
required

The file's name, including its extension.

Example:

"pitch-deck.pdf"

size
integer<int64>
required

The file's size in bytes.

Required range: 0 <= x <= 9007199254740991
Example:

245760

type
string | null
required

The file's MIME content type. null when the content type is not recorded.

Example:

"application/pdf"

creator
PersonReference · object | null
required

The person who uploaded the file. null when the uploader is not recorded.

person
PersonReference · object | null
required

The person that the file is attached to. null when the file is not attached to a person. At most one of company, person, or opportunity is non-null on a file.

company
CompanyReference · object | null
required

The company that the file is attached to. null when the file is not attached to a company. At most one of company, person, or opportunity is non-null on a file.

opportunity
OpportunityReference · object | null
required

The opportunity that the file is attached to. null when the file is not attached to an opportunity. At most one of company, person, or opportunity is non-null on a file.

createdAt
string<date-time>
required

When the file was uploaded.

Example:

"2026-01-01T00:00:00Z"

updatedAt
string<date-time> | null
required

When the file was last updated. null if the file has never been updated.

Example:

"2026-01-01T00:00:00Z"

downloadUrl
string<uri>
required

A temporary signed URL to download the file's contents. Expires 60 seconds after the response is generated.

Example:

"https://user-files.affinity.co/deal-files/abc123?signature=xyz"