Developers

Attachments

GET /api/v1/attachments/{id} reads a job link or a file, two POSTs upload a file to an application or a candidate, and DELETE removes a file from an application. A file needs Read candidate data to read and Write candidate data to add or delete.

Overview

An attachment is a link in a job's Resources, a file on a candidate or a file on an application. GET /api/v1/attachments/{id} reads one. Adding a file takes two calls: POST /api/v1/attachments/uploads prepares an upload and answers a link to send the file to, and POST /api/v1/attachments adds the uploaded file to its application or candidate.

A link on a job needs the Read permission. A file names a candidate, so reading one needs Read candidate data and adding one needs Write candidate data. A key holds those two only while an admin has turned on Candidate data in the API in Settings → API. Candidate data explains the same rule for a signed-in client.

Version 1 does not list a record's attachments, so you read a file you added by the id the second call answered.

Get an attachment

curl "https://attia.app/api/v1/attachments/0192f3e1-6c2a-7d4b-8e19-3a5f7b9c1d20" \  -H "Authorization: Bearer $ATTIA_API_KEY"
ParameterTypeMeaning
idUUIDThe attachment's id, in the path

The call takes no query parameter. A parameter gets a 400 with the code invalid-request.

The answer holds the attachment in data.

{  "data": {    "id": "0192f3e1-6c2a-7d4b-8e19-3a5f7b9c1d20",    "kind": "candidate_file",    "title": "cv.pdf",    "url": "https://…",    "url_expires_at": "2026-10-02T08:20:42.301822Z",    "job_id": null,    "application_id": null,    "candidate_id": "0192f3c4-2d18-7a6e-9f30-6b1e8c2d4a77",    "content_type": "application/pdf",    "size": 182044,    "created_at": "2026-10-02T08:15:42.301822Z"  }}
FieldTypeMeaning
idUUIDThe attachment's id. It never changes
kindstringjob_link, candidate_file or application_file
titlestring or nullThe link's title, or the file's name. null for a link saved without a title
urlstringThe link's address, or for a file a download link
url_expires_attimestamp or nullWhen a file's download link stops working. null for a link
job_idUUID or nullThe job the link or the file belongs to
application_idUUID or nullThe application the file belongs to
candidate_idUUID or nullThe candidate the file belongs to. null for a link
content_typestring or nullThe file's media type. null for a link
sizeinteger or nullThe file's size in bytes. null for a link
created_attimestampWhen the link or the file was added

A file's url is a signed download link that works for five minutes, as a link the app opens does. Get the attachment again for a new one, and do not store the link. A link on a job answers its address as it was saved. Timestamps, nulls and enums describes each format.

Each read of a file goes in the workspace's audit log, as when someone opens the file in the app. The entry names you and the app you connected through.

An attachment you cannot read gets a 404 not-found: another workspace's, a deleted one, one on a job or a candidate that your key's team access leaves out, and any file when your key does not read candidate data. The answer is the same for an id that does not exist.

Prepare an upload

curl -X POST "https://attia.app/api/v1/attachments/uploads" \  -H "Authorization: Bearer $ATTIA_API_KEY" \  -H "Content-Type: application/json" \  -H "Idempotency-Key: 0192f3e2-0a4d-7c51-9b3e-5d7f1a3c5e70" \  -d '{"candidate_id": "0192f3c4-2d18-7a6e-9f30-6b1e8c2d4a77", "filename": "cv.pdf", "content_type": "application/pdf", "size": 182044}'

Send exactly one of application_id and candidate_id.

FieldTypeMeaning
application_idUUIDThe application to add the file to
candidate_idUUIDThe candidate to add the file to
filenamestring, 1 to 255 charactersThe file's name, as people will see it
content_typestringThe file's media type, such as application/pdf
sizeintegerThe file's size in bytes

The file rules are the app's. A candidate file is at most 26214400 bytes (25 MB), of a type the workspace accepts. An application file is at most 4491808 bytes, and an image, a video or a document: PDF, Word, Excel, PowerPoint, RTF, plain text, CSV or Markdown. Adding a file to an application needs the access that adding one in the app needs. A file that breaks a rule gets a 400 invalid-request that names the field.

The answer is a 201 with the upload in data.

{  "data": {    "id": "0192f3e5-4b1c-7e2a-8d3f-9c6a1e4b7d02",    "upload_url": "https://…",    "method": "PUT",    "headers": { "Content-Type": "application/pdf" },    "expires_at": "2026-10-02T10:15:42.301822Z",    "application_id": null,    "candidate_id": "0192f3c4-2d18-7a6e-9f30-6b1e8c2d4a77",    "filename": "cv.pdf",    "content_type": "application/pdf",    "size": 182044  }}
FieldTypeMeaning
idUUIDThe upload's id. Send it to the next call
upload_urlstringWhere to send the file
methodstringAlways PUT
headersobjectThe headers to send with the file
expires_attimestampWhen the link and the upload stop working, two hours after the call
application_idUUID or nullThe application, as you sent it
candidate_idUUID or nullThe candidate, as you sent it
filenamestringThe file's name, as you sent it
content_typestringThe file's media type, as you sent it
sizeintegerThe file's size, as you sent it

Then send the file's bytes to upload_url, once, with the headers in headers:

curl -X PUT "$UPLOAD_URL" \  -H "Content-Type: application/pdf" \  --data-binary @cv.pdf

The link takes no API key. Until you use it, anyone who has it can upload a file to this one upload, so keep it as you keep a key. The file appears nowhere in Attia until the next call adds it.

Link the file

curl -X POST "https://attia.app/api/v1/attachments" \  -H "Authorization: Bearer $ATTIA_API_KEY" \  -H "Content-Type: application/json" \  -H "Idempotency-Key: 0192f3e6-1d7a-7b3c-9e40-2f8b5c1a6d93" \  -d '{"upload_id": "0192f3e5-4b1c-7e2a-8d3f-9c6a1e4b7d02"}'
FieldTypeMeaning
upload_idUUIDThe id the prepare answered

The answer is a 201 with the attachment in data, as Get an attachment gives it, and its address in the Location header. Here url is that address and url_expires_at is null: get the attachment for a download link. The file appears on the application or the candidate, with the same activity and the same audit log entry as a file added in the app. Both name you and the app you connected through.

Attia checks the stored file against the prepare. Each of these gets a 400 invalid-request on upload_id:

  • No file has been sent to the link yet. Send it, then make the same call again.
  • The file's size or type is not the one you prepared. Attia deletes the file. Prepare a new upload.
  • The upload has expired. Attia deletes any file it holds. Prepare a new upload.
  • The upload is already linked, or was refused before.

Only the key or the sign-in that prepared an upload can link it. Another key, a colleague's included, gets a 404 not-found, and so does an upload of another workspace. So does an upload whose application or candidate you can no longer read.

Without Write candidate data, both calls get insufficient-scope. A view-only workspace gets workspace-view-only, and an address outside the workspace's allowed networks gets ip-not-allowed.

Retry an upload safely

Both calls need an Idempotency-Key header. Pick a new value for each call: 1 to 255 letters, digits, - or _. A UUID works. A call without one gets a 400 idempotency-key-required.

When a call times out or the connection drops, send it again with the same key. Within 24 hours, the same key with the same body and the same API key gets the first answer back, plus the header Idempotency-Replayed: true. A replayed prepare answers the same upload until it expires, and after that a 400 invalid-request on idempotency_key: prepare a new upload with a new key. A replayed link answers the same attachment and adds the file once.

The same key with another body or another API key gets a 422 idempotency-key-reused, and so does the same key after 24 hours, up to 90 days. A refused call keeps nothing, so you can send it again with the same key once you have fixed the cause.

Delete an application file

DELETE /api/v1/attachments/{id} deletes a file on an application, as Delete does in the app. It needs Write candidate data and an Idempotency-Key header.

curl -X DELETE "https://attia.app/api/v1/attachments/0192f3e7-2e8b-7c4d-8f51-3a9c6d2b7e04" \  -H "Authorization: Bearer $ATTIA_API_KEY" \  -H "Idempotency-Key: 0192f3e8-3f9c-7d5e-9a62-4b0d7e3c8f15"
ParameterTypeMeaning
idUUIDIn the path: the application file's id

The answer is a 204 with no body. As in the app, the file leaves the application at once, and Attia removes it for good after 30 days. The application's activity and the audit log record the delete, and both name you and the app you connected through. The same Idempotency-Key within 24 hours gets the 204 again and deletes nothing.

Only a file on an application can be deleted here. A link on a job or a file on a candidate gets a 400 invalid-request that names id: remove those in Attia. A file on an application you cannot change, one your key cannot read or one already deleted gets a 404 not-found.