Files
A file is a document you upload and attach to an application.
POST /files
The file object
| Field | Type | Description |
|---|---|---|
id | string | |
object | string | Always file. |
purpose | enum | What the file is. One of identity_document_front, identity_document_back, proof_of_study, visa, tenancy_agreement, other. |
filename | string | |
content_type | string | |
size | integer | Size in bytes. |
created_at | date-time |
Upload a file
POST/files
Uploads a file. Send the request as multipart/form-data. Files can be JPEG, PNG or PDF, up to 10 MB.
Files that aren't attached to an application are deleted after 7 days.
Request body
| Field | Type | Description |
|---|---|---|
filerequired | file | The file contents. |
purposerequired | enum | What the file is. One of identity_document_front, identity_document_back, proof_of_study, visa, tenancy_agreement, other. |
Example request
curl https://api.thestudentguarantor.com/v1/files \
-X POST \
-H "Authorization: Bearer $TSG_SECRET_KEY" \
-H "Idempotency-Key: 6f1c2a9e-8f0b-4c59-9d0e-2b7a54d0c1aa" \
-F "purpose=identity_document_front" \
-F "file=@id-front.jpg"
Returns
Returns the file object.
Example response
{
"id": "file_5pXr9LmA2dQe7NzK",
"object": "file",
"purpose": "identity_document_front",
"filename": "id-front.jpg",
"content_type": "image/jpeg",
"size": 482113,
"created_at": "2026-11-19T09:15:40Z"
}