Files

A file is a document you upload and attach to an application.

POST   /files

The file object

FieldTypeDescription
idstring
objectstringAlways file.
purposeenumWhat the file is. One of identity_document_front, identity_document_back, proof_of_study, visa, tenancy_agreement, other.
filenamestring
content_typestring
sizeintegerSize in bytes.
created_atdate-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

FieldTypeDescription
filerequiredfileThe file contents.
purposerequiredenumWhat 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"
}