The Student Guarantor API Reference
The Student Guarantor API is organised around REST. It has resource-oriented URLs, accepts JSON request bodies, returns JSON responses, and uses standard HTTP response codes, authentication and verbs.
The base URL for every request is:
https://api.thestudentguarantor.com/v1
Use the sandbox to test your integration without creating real applications. The API key you use determines whether a request runs in the sandbox or in production.
| Environment | Key prefix |
|---|---|
| Sandbox | tsg_test_sk_ |
| Production | tsg_live_sk_ |
1Integration flow
Solid arrows are requests. Dashed arrows are responses and callbacks. Webhooks are requests from the API to your server.
2Authentication
The API uses API keys to authenticate requests. Provide your secret key as a bearer token.
curl https://api.thestudentguarantor.com/v1/applications \
-H "Authorization: Bearer tsg_test_sk_4f9c…"
Secret keys carry full access to your account. Keep them on your server and don't expose them in client-side code. Client-side code uses a session's client_secret instead.
All requests must be made over HTTPS. Calls made over plain HTTP fail. Requests without a valid key return 401.
You can have two active keys per environment, which lets you rotate keys without downtime. You can restrict a production key to a list of source IP addresses.
3Errors
The API uses conventional HTTP response codes. Codes in the 2xx range indicate success. Codes in the 4xx range indicate a request that failed given the information provided. Codes in the 5xx range indicate an error on our servers.
{
"error": {
"type": "validation_error",
"code": "date_range_invalid",
"message": "tenancy.end_date must be after tenancy.start_date.",
"param": "tenancy.end_date",
"request_id": "req_5tH9jK2mNb"
}
}
| Status | Type | Description |
|---|---|---|
400 | invalid_request_error | The request is malformed or missing a required parameter. |
401 | authentication_error | No valid API key provided. |
403 | permission_error | The API key can't perform the request. |
404 | not_found_error | The requested object doesn't exist. |
409 | conflict_error | The request conflicts with another request or with the object's current state. |
422 | validation_error | A parameter failed validation. |
429 | rate_limit_error | Too many requests. Retry after the number of seconds in Retry-After. |
5xx | api_error | Something went wrong on our end. Retry with the same idempotency key. |
Handle errors by code. The message is for developers and can change.
| Code | Description |
|---|---|
parameter_missing | A required parameter is missing. See param. |
parameter_invalid | A parameter has the wrong type or format. See param. |
external_reference_in_use | An application with this external_reference exists. Its ID is in existing_id. |
idempotency_key_reused | The idempotency key was used with different parameters. |
quote_expired | The quote is past its expires_at. |
quote_mismatch | The application's priced details differ from the quote's. |
tenancy_not_eligible | The tenancy can't be guaranteed. |
file_not_found | A referenced file doesn't exist or has been deleted. |
file_type_unsupported | The file isn't a JPEG, PNG or PDF. |
application_not_editable | The application's status or signatures don't allow this update. |
fee_collection_mismatch | The application's fee.collection isn't partner. |
fee_amount_mismatch | The confirmed amount differs from fee.amount. |
fee_changed | The fee is no longer the quoted fee or fee.amount. Create a new quote. |
session_not_available | No requirement can be completed in a session. |
fee_already_collected | The fee is paid, so the fee or a priced detail can't change. |
cosigner_email_same_as_tenant | The cosigner and the tenant have the same email. |
tenant_email_not_allowed | The tenant's email can't be used for an application. |
university_not_found | No university has this university_id. |
endpoint_limit_reached | The account has 5 webhook endpoints in this environment. |
document_not_available | The guarantee has no signed agreement to download. |
request_in_progress | A request with this idempotency key is still running. |
simulation_not_applicable | The simulated action has nothing to do on this application. |
4Idempotent requests
The API supports idempotency for safely retrying requests without performing the same operation twice. To make an idempotent request, provide an Idempotency-Key header.
curl https://api.thestudentguarantor.com/v1/applications \
-H "Authorization: Bearer tsg_test_sk_4f9c…" \
-H "Idempotency-Key: 6f1c2a9e-8f0b-4c59-9d0e-2b7a54d0c1aa" \
-d @application.json
The API saves the status code and body of the first request made with a key and returns them for subsequent requests with the same key. Keys expire after 24 hours and can be up to 255 characters. We recommend V4 UUIDs. Reusing a key with different parameters returns 409.
All POST and PATCH requests accept idempotency keys. GET and DELETE requests are idempotent by definition.
5Pagination
All list endpoints return objects in reverse chronological order and share the same parameters: limit, between 1 and 100 with a default of 20, and starting_after, the ID of the last object on the previous page.
{
"object": "list",
"data": [ … ],
"has_more": true
}
6Request IDs
Each request has an identifier, returned in the Request-Id response header and in error.request_id. Include it when you contact us about a request.
7Rate limits
The API allows 25 requests per second per key. Requests over the limit return 429 with a Retry-After header.
8Versioning
The version is part of the path. Backwards-compatible changes are released within /v1: new endpoints, new optional parameters, new response fields, new enum values and new event types. Your integration should ignore fields and values it doesn't recognise.
9Data formats
| Type | Format | Example |
|---|---|---|
| Amount | Object with an integer amount in the currency's smallest unit and an ISO 4217 currency. | {"amount": 50000, "currency": "GBP"} |
| Rent | Amount with a period of week, month or total. | {"amount": 32500, "currency": "GBP", "period": "week"} |
| Date | ISO 8601 calendar date. | 2026-10-24 |
| Timestamp | ISO 8601, UTC. | 2026-11-19T09:16:03Z |
| Country | ISO 3166-1 alpha-2. | CN |
| Phone number | E.164. | +8613800139527 |
| Locale | en or zh-CN. | zh-CN |
| Object ID | String prefixed by object type: quo_, app_, gua_, file_, sess_, evt_, whk_. | app_3Nf7QwR1tY8uLk5H |
10Application statuses
| Status | Description |
|---|---|
incomplete | One or more requirements are due or blocked. |
in_review | All requirements are satisfied or in review. |
approved | The guarantee is issued. Its ID is in guarantee. |
declined | No guarantee will be issued. The reason is in decline_reason. |
cancelled | The application was cancelled through the API. |
expired | The application wasn't completed before expires_at. |
Requirements
An application's requirements list what must be completed before it can be approved. Each requirement has a code, the party responsible, a status and the ways it can be completed. The requirements on an application depend on the applicant and on your account configuration. Don't assume a fixed set.
| Code | Satisfied when | completable_via |
|---|---|---|
tenant.details | The tenant's personal details are complete. | api, session |
tenant.identity | The tenant's identity is verified. Blocked until fee.payment is satisfied. | api for cn_resident_id, otherwise session |
tenant.proof_of_study | An offer or enrolment letter is provided. | api, session |
tenant.right_to_rent | A Right to Rent share code is provided. | api, session |
tenant.signature | The tenant has signed the agreement. Blocked until the landlord requirements on the application are satisfied. | session |
tenancy.details | The property, rent, dates and landlord details are complete. | api |
cosigner.details | The cosigner's personal details are complete. | api, session |
cosigner.identity | The cosigner's identity is verified. | api for cn_resident_id, otherwise email_link |
cosigner.signature | The cosigner has signed the agreement. | email_link |
landlord.confirmation | The landlord has confirmed the tenancy details. | email_link |
landlord.signature | The landlord has signed the agreement. | email_link |
fee.payment | The fee is paid. | api or session, by fee.collection |
| Requirement status | Description |
|---|---|
due | Waiting for party. If a submission was rejected, reason says why. |
in_review | Submitted and being checked. |
blocked | Can't be completed until another requirement is satisfied. |
satisfied | Complete. |
11Embedded component
The component renders the requirements a tenant can complete in a session. Load the script, create a session on your server, and mount the component with the session's client_secret.
<div id="tsg-guarantee"></div>
<script src="https://app.thestudentguarantor.com/embed/v1/guarantee.js"></script>
<script>
const guarantee = TSG.guarantee({
clientSecret: "sess_9Tg4HbN6mJ2kLp8Q_secret_x7Vq2ZcR5tYw8Ub1",
locale: "zh-CN",
appearance: { accentColor: "#FF5A5F" },
onComplete: (event) => { /* event.applicationId, event.outstanding */ },
onExit: (event) => { /* event.reason */ },
onError: (event) => { /* event.code */ }
});
guarantee.mount("#tsg-guarantee");
</script>
Methods
| Method | Description |
|---|---|
TSG.guarantee(options) | Creates a component instance for a session. |
guarantee.mount(selector) | Renders the component in the element matching selector. |
guarantee.unmount() | Removes the component from the DOM. It can be mounted again. |
guarantee.destroy() | Removes the component and discards the session on the client. |
Options
| Option | Type | Description |
|---|---|---|
clientSecretrequired | string | The session's client_secret. |
locale | string | en or zh-CN. Defaults to the session's locale. |
appearance.accentColor | string | Hex colour for buttons and links. |
appearance.borderRadius | string | CSS length for corners. |
appearance.fontFamily | string | System font stack. |
Events
| Callback | Payload | Description |
|---|---|---|
onReady | Called when the component has rendered. | |
onStepChange | step | Called when the tenant moves to another step. Steps appear in this order, and only when the tenant has something to complete in them: review, payment, documents, agreement, done. |
onComplete | applicationId, outstanding | Called when the tenant has completed every requirement available to them. outstanding lists the codes that remain for other parties. |
onExit | reason | Called when the tenant leaves before completing. reason is closed or expired. |
onError | code, message | Called when the component can't continue. Codes include session_invalid, session_expired, origin_not_allowed and payment_unavailable. |
The component only renders on the origins registered for your account. Don't rely on onComplete to update your records. Retrieve the application or listen for application.requirements_updated.
Redirect mode
To use the component where the script can't run, such as a native app or a WeChat mini program, create the session with mode: "redirect" and open its url in a web view. When the tenant finishes or leaves, they are redirected to your return_url with application_id and session_status appended. The return_url must be an HTTPS URL on one of the origins registered for your account.
Content Security Policy
script-src https://app.thestudentguarantor.com
frame-src https://app.thestudentguarantor.com
12Fee collection
The fee.collection attribute determines how the fee.payment requirement is satisfied.
fee.collection | Description |
|---|---|
partner | You charge the tenant, then confirm the fee. |
tsg | The tenant pays in the component's payment step. Available in the sandbox only during the preview. |
13Webhooks
The API sends events to your webhook endpoints as POST requests with a JSON body.
POST /hooks/tsg HTTP/1.1
Content-Type: application/json
TSG-Event-Id: evt_4Rt7YuI1oP3aS6dF
TSG-Signature: t=1795080687,v1=5d1c0f0b6a7e3c9a…
{
"id": "evt_4Rt7YuI1oP3aS6dF",
"object": "event",
"type": "application.approved",
"livemode": false,
"created_at": "2026-11-19T09:31:27Z",
"data": {
"object": {
"id": "app_3Nf7QwR1tY8uLk5H",
"object": "application",
"status": "approved",
"guarantee": "gua_6Yh2JmK9pL4nB7vC"
}
}
}
Event types
| Type | data.object | Description |
|---|---|---|
application.created | application | Occurs when an application is created. |
application.requirements_updated | application | Occurs when the status of a requirement changes. |
application.in_review | application | Occurs when an application enters review. |
application.approved | application | Occurs when an application is approved. |
application.declined | application | Occurs when an application is declined. |
application.cancelled | application | Occurs when an application is cancelled. |
application.expired | application | Occurs when an application expires. |
fee.paid | application | Occurs when a fee is confirmed or paid. |
fee.refunded | application | Occurs when a fee is refunded in full or in part. |
guarantee.issued | guarantee | Occurs when a guarantee is issued. |
guarantee.updated | guarantee | Occurs when a guarantee's cover is amended. |
guarantee.ended | guarantee | Occurs when a guarantee ends. |
Verify signatures
Each request includes a TSG-Signature header with a timestamp t and a signature v1. The signature is the HMAC-SHA256, keyed with the endpoint's secret, of the timestamp, a . character and the raw request body. Compute it, compare it with v1 using a constant-time comparison, and reject requests with a timestamp older than five minutes.
For 24 hours after you roll an endpoint's secret, the header carries two v1 values, one for the new secret and one for the old. Accept the request if any v1 matches.
const crypto = require("crypto");
function verify(rawBody, header, secret) {
const parts = header.split(",").map((p) => p.split("="));
const t = (parts.find(([k]) => k === "t") || [])[1];
const expected = Buffer.from(crypto.createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex"));
const matches = parts.some(([k, v]) => k === "v1" && v.length === expected.length && crypto.timingSafeEqual(Buffer.from(v), expected));
return matches && Math.abs(Date.now() / 1000 - Number(t)) <= 300;
}
Delivery
- Return a
2xxresponse within 10 seconds. Any other response, or a timeout, is treated as a failure. - Failed deliveries are retried with exponential backoff for up to 24 hours.
- Your endpoint can receive the same event more than once. Use
TSG-Event-Idto detect duplicates. - Event order isn't guaranteed. Retrieve the object if you need its current state.
14Testing
In the sandbox, no identity checks run, no payments are taken and no emails are sent. Use simulate an outcome to complete requirements for the tenant, cosigner and landlord.
To trigger a specific outcome, create the application with one of these values as tenant.last_name.
tenant.last_name | Outcome |
|---|---|
Unreadable | tenant.identity returns to due with reason: "document_unreadable". |
Mismatch | tenant.identity returns to due with reason: "name_mismatch". |
Review | The application stays in_review until you simulate approve or decline. |
Decline | The application is declined with decline_reason: "tenant_not_eligible". |
The component's payment step accepts the test card 4242 4242 4242 4242.
15Resources
15.1Reference data
Lookup values for universities and countries.
GET /universities
GET /countries
List universities
Returns a list of universities. Use a university's id as study.university_id.
Parameters
| Name | In | Description |
|---|---|---|
q | query | Case-insensitive search across the English and Chinese names. |
Returns
Returns a list of university objects.
Example response
{
"object": "list",
"data": [
{
"id": "uni_ucl",
"object": "university",
"name": "University College London",
"name_zh": "伦敦大学学院",
"country": "GB"
}
],
"has_more": false
}
List countries
Returns the list of supported countries.
Returns
Returns a list of country objects.
Example response
{
"object": "list",
"data": [
{
"code": "CN",
"object": "country",
"name": "China",
"name_zh": "中国"
},
{
"code": "MY",
"object": "country",
"name": "Malaysia",
"name_zh": "马来西亚"
}
],
"has_more": false
}
15.2Quotes
A quote is the fee for a guarantee on one tenancy.
POST /quotes
GET /quotes/{quote_id}
The quote object
| Field | Type | Description |
|---|---|---|
id | string | |
object | string | Always quote. |
livemode | boolean | false in the sandbox. |
fee | object | The fee for the tenancy. |
fee.amount | integer | The amount in the currency's smallest unit. 50000 is £500.00. |
fee.currency | string | ISO 4217 code. Fees are always GBP. |
monthly_rent_share | object | The tenant's rent for one calendar month, rounded to the nearest pound (50p rounds up). The fee is calculated on this figure. |
monthly_rent_share.amount | integer | The amount in the currency's smallest unit. 50000 is £500.00. |
monthly_rent_share.currency | string | ISO 4217 code. Fees are always GBP. |
eligibility | object | |
eligibility.status | enum | eligible: an application can be created. review: an application can be created and will be reviewed manually. ineligible: an application with these details will be rejected with 422. |
eligibility.reasons | array of string | Machine-readable reasons when status is not eligible, for example property_country_unsupported. |
expires_at | date-time | |
created_at | date-time |
Create a quote
Creates a quote. To apply the quoted fee to an application, pass the quote's id as quote_id before expires_at. If the fee for the same details has changed since the quote was created, the application is rejected with 409 fee_changed. Create a new quote.
Request body
| Field | Type | Description |
|---|---|---|
applicant_type | enum | Type of applicant. One of student, graduate. Default student. |
tenantrequired | object | |
tenant.nationalityrequired | string | ISO 3166-1 alpha-2 code. |
tenant.country_of_residence | string | ISO 3166-1 alpha-2 code. Defaults to the nationality. |
study | object | Required when applicant_type is student. |
study.university_id | string | From the universities list. Send either this or university_name. |
study.university_name | string | For an institution not in the universities list. |
study.course | string | |
study.levelrequired | enum | One of foundation, undergraduate, postgraduate, other. |
study.first_year | boolean | Whether this tenancy covers the tenant's first year at the university. |
propertyrequired | object | |
property.countryrequired | string | ISO 3166-1 alpha-2 code of the property. Currently GB. |
property.postcode | string | UK postcode. |
tenancyrequired | object | |
tenancy.rentrequired | object | |
tenancy.rent.amountrequired | integer | The tenant's own share of the rent for one period, in pence. |
tenancy.rent.currencyrequired | string | Always GBP. |
tenancy.rent.periodrequired | enum | What amount covers. total is the whole rent for the tenancy from start date to end date. One of week, month, total. |
tenancy.start_daterequired | date | |
tenancy.end_date | date | Required unless the tenancy is periodic with no fixed end. |
tenancy.tenant_count | integer | How many tenants are named on the tenancy. Default 1. |
cosigner_relationship | enum | The cosigner's relationship to the tenant, if known. One of parent, guardian, relative, spouse, friend, other. |
Example request
curl https://api.thestudentguarantor.com/v1/quotes \
-X POST \
-H "Authorization: Bearer $TSG_SECRET_KEY" \
-H "Idempotency-Key: 6f1c2a9e-8f0b-4c59-9d0e-2b7a54d0c1aa" \
-H "Content-Type: application/json" \
-d '{
"tenant": {
"nationality": "CN",
"country_of_residence": "CN"
},
"study": {
"university_id": "uni_ucl",
"level": "postgraduate",
"first_year": true
},
"property": {
"country": "GB",
"postcode": "E1 6LT"
},
"tenancy": {
"rent": {
"amount": 32500,
"currency": "GBP",
"period": "week"
},
"start_date": "2026-10-24",
"end_date": "2027-07-10",
"tenant_count": 1
}
}'
Returns
Returns the quote object.
Example response
{
"id": "quo_8Kc2VnQ4hT7xWm3B",
"object": "quote",
"livemode": false,
"fee": {
"amount": 50000,
"currency": "GBP"
},
"monthly_rent_share": {
"amount": 140800,
"currency": "GBP"
},
"eligibility": {
"status": "eligible",
"reasons": []
},
"expires_at": "2026-11-26T09:14:02Z",
"created_at": "2026-11-19T09:14:02Z"
}
Retrieve a quote
Retrieves a quote.
Returns
Returns the quote object.
15.3Files
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
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"
}
15.4Applications
An application is a request for a guarantee. It tracks the requirements that must be completed before the guarantee is issued.
POST /applications
GET /applications
GET /applications/{application_id}
PATCH /applications/{application_id}
POST /applications/{application_id}/cancel
POST /applications/{application_id}/fee/confirm
The application object
| Field | Type | Description |
|---|---|---|
id | string | |
object | string | Always application. |
livemode | boolean | |
external_reference | string | |
status | enum | incomplete: at least one requirement is due or blocked. in_review: all requirements are supplied and the application is being reviewed. approved: the guarantee is issued. declined: no guarantee will be issued. cancelled: cancelled by you. expired: not completed before expires_at. |
applicant_type | enum | Type of applicant. One of student, graduate. Default student. |
locale | string | |
tenant | object | The tenant's name and email. |
tenant.first_name | string | |
tenant.last_name | string | |
tenant.email | string | |
fee | object | |
fee.collection | enum | One of partner, tsg. |
fee.amount | object | |
fee.amount.amount | integer | The amount in the currency's smallest unit. 50000 is £500.00. |
fee.amount.currency | string | ISO 4217 code. Fees are always GBP. |
fee.status | enum | One of unpaid, paid, refunded, partially_refunded. |
fee.paid_at | date-time | |
requirements | array of object | The application's requirements. |
requirements[].code | enum | Identifier of the requirement. One of tenant.details, tenant.identity, tenant.proof_of_study, tenant.right_to_rent, tenant.signature, cosigner.details, cosigner.identity, cosigner.signature, tenancy.details, fee.payment, landlord.confirmation, landlord.signature. |
requirements[].party | enum | Party responsible for the requirement. One of partner, tenant, cosigner, landlord, tsg. |
requirements[].status | enum | due: waiting for party. in_review: supplied and being checked. blocked: cannot start until another requirement is satisfied. satisfied: done. |
requirements[].completable_via | array of enum | api: supply it with an update. session: the tenant completes it in the embedded component. email_link: we email the party a link. |
requirements[].fields | array of string | For *.details requirements, the missing or invalid field paths. |
requirements[].reason | string or null | A machine-readable reason when a supplied item was not accepted, for example document_unreadable, document_expired, name_mismatch. |
decline_reason | enum | One of identity_not_verified, tenancy_not_eligible, tenant_not_eligible, suspected_fraud, other. |
guarantee | string or null | The guarantee ID once approved. |
metadata | object | |
expires_at | date-time | |
created_at | date-time | |
updated_at | date-time |
Create an application
Creates an application. Any information you don't provide is added to requirements.
Request body
| Field | Type | Description |
|---|---|---|
external_referencerequired | string | Your identifier for the application. Must be unique. |
quote_id | string | ID of a quote to apply. If omitted, the fee is calculated from the application. |
applicant_type | enum | Type of applicant. One of student, graduate. Default student. |
locale | enum | Language of the tenant's sessions and emails. One of en, zh-CN. Default en. |
tenantrequired | object | |
tenant.first_namerequired | string | Given name in Latin characters, as on the identity document. |
tenant.last_namerequired | string | Family name in Latin characters. |
tenant.name_local | string | The full name in its original script, for example 张雨曦. Used to check Chinese identity cards. |
tenant.emailrequired | ||
tenant.phone | string | E.164 format. |
tenant.date_of_birth | date | |
tenant.nationalityrequired | string | ISO 3166-1 alpha-2 code. |
tenant.country_of_residence | string | ISO 3166-1 alpha-2 code. |
tenant.address | object | Home address outside the rented property. |
tenant.address.line1required | string | |
tenant.address.line2 | string | |
tenant.address.cityrequired | string | |
tenant.address.state | string | State |
tenant.address.postal_code | string | |
tenant.address.countryrequired | string | ISO 3166-1 alpha-2 code. |
tenant.right_to_rent_share_code | string | GOV.UK Right to Rent share code. |
study | object | Required when applicant_type is student. |
study.university_id | string | From the universities list. Send either this or university_name. |
study.university_name | string | For an institution not in the universities list. |
study.course | string | |
study.levelrequired | enum | One of foundation, undergraduate, postgraduate, other. |
study.first_year | boolean | Whether this tenancy covers the tenant's first year at the university. |
propertyrequired | object | |
property.name | string | The room or unit as you list it, for example Gold Studio Plus. |
property.line1required | string | |
property.line2 | string | |
property.cityrequired | string | |
property.postcoderequired | string | |
property.countryrequired | string | Currently GB. |
property.accommodation_type | enum | pbsa is purpose-built student accommodation run by a private operator. One of pbsa, university_halls, private, other. |
tenancyrequired | object | |
tenancy.agreement_type | enum | Type of tenancy agreement. One of licence, assured_periodic, common_law, other. |
tenancy.rentrequired | object | |
tenancy.rent.amountrequired | integer | The tenant's own share of the rent for one period, in pence. |
tenancy.rent.currencyrequired | string | Always GBP. |
tenancy.rent.periodrequired | enum | What amount covers. total is the whole rent for the tenancy from start date to end date. One of week, month, total. |
tenancy.start_daterequired | date | |
tenancy.end_date | date | Required unless agreement_type is assured_periodic. |
tenancy.tenant_count | integer | Default 1. |
tenancy.total_rent | object | The rent for the whole property, when tenant_count is more than 1. |
tenancy.total_rent.amountrequired | integer | The tenant's own share of the rent for one period, in pence. |
tenancy.total_rent.currencyrequired | string | Always GBP. |
tenancy.total_rent.periodrequired | enum | What amount covers. total is the whole rent for the tenancy from start date to end date. One of week, month, total. |
tenancy.payment_schedule | enum | How the tenant pays rent to the accommodation provider. One of monthly, instalments. |
tenancy.landlord | object | The landlord's contact details. |
tenancy.landlord.namerequired | string | |
tenancy.landlord.email | ||
tenancy.landlord.phone | string | |
tenancy.landlord.address | object | |
cosigner | object | The cosigner's details. |
cosigner.first_namerequired | string | |
cosigner.last_namerequired | string | |
cosigner.name_local | string | |
cosigner.relationshiprequired | enum | One of parent, guardian, relative, spouse, friend, other. |
cosigner.emailrequired | Must differ from the tenant's. The signing link is sent here. | |
cosigner.phone | string | E.164 format. |
cosigner.date_of_birth | date | |
cosigner.nationality | string | |
cosigner.country_of_residence | string | |
cosigner.address | object | |
cosigner.address.line1required | string | |
cosigner.address.line2 | string | |
cosigner.address.cityrequired | string | |
cosigner.address.state | string | State |
cosigner.address.postal_code | string | |
cosigner.address.countryrequired | string | ISO 3166-1 alpha-2 code. |
cosigner.locale | enum | The language of the cosigner's emails. Defaults to the application's locale. One of en, zh-CN. |
documents | object | |
documents.tenant_identity | object | Images of an identity document. Supported for Chinese resident identity cards only. |
documents.tenant_identity.typerequired | enum | One of cn_resident_id. |
documents.tenant_identity.frontrequired | string | A file ID. The side with the photograph. |
documents.tenant_identity.backrequired | string | A file ID. The side with the national emblem. |
documents.cosigner_identity | object | Images of an identity document. Supported for Chinese resident identity cards only. |
documents.cosigner_identity.typerequired | enum | One of cn_resident_id. |
documents.cosigner_identity.frontrequired | string | A file ID. The side with the photograph. |
documents.cosigner_identity.backrequired | string | A file ID. The side with the national emblem. |
documents.proof_of_study | string | A file ID. Offer or enrolment letter. |
documents.visa | string | A file ID. |
documents.tenancy_agreement | string | A file ID. |
fee | object | |
fee.collectionrequired | enum | partner: you charge the tenant and confirm the fee through the API. tsg: the tenant pays in a session. Defaults to the mode configured for your account. |
consentsrequired | object | |
consents.data_sharingrequired | object | The tenant's consent to share their details with The Student Guarantor. |
consents.data_sharing.accepted_atrequired | date-time | |
consents.data_sharing.ip_address | string | |
consents.data_sharing.wording_version | string | Your identifier for the consent wording shown. |
metadata | object | Set of up to 20 key-value pairs that you can attach to the object. |
Example request
curl https://api.thestudentguarantor.com/v1/applications \
-X POST \
-H "Authorization: Bearer $TSG_SECRET_KEY" \
-H "Idempotency-Key: 6f1c2a9e-8f0b-4c59-9d0e-2b7a54d0c1aa" \
-H "Content-Type: application/json" \
-d '{
"external_reference": "BK-2026-223515",
"quote_id": "quo_8Kc2VnQ4hT7xWm3B",
"applicant_type": "student",
"locale": "zh-CN",
"tenant": {
"first_name": "Yuxi",
"last_name": "Zhang",
"name_local": "张雨曦",
"email": "yuxi.zhang@example.com",
"phone": "+8613800139527",
"date_of_birth": "2003-04-17",
"nationality": "CN",
"country_of_residence": "CN",
"address": {
"line1": "88 Century Avenue",
"city": "Shanghai",
"postal_code": "200120",
"country": "CN"
}
},
"study": {
"university_id": "uni_ucl",
"course": "MSc Data Science",
"level": "postgraduate",
"first_year": true
},
"property": {
"name": "Gold Studio Plus",
"line1": "Flat 218, Tower Building",
"line2": "12 Example Street",
"city": "London",
"postcode": "E1 6LT",
"country": "GB",
"accommodation_type": "pbsa"
},
"tenancy": {
"agreement_type": "licence",
"rent": {
"amount": 32500,
"currency": "GBP",
"period": "week"
},
"start_date": "2026-10-24",
"end_date": "2027-07-10",
"tenant_count": 1,
"landlord": {
"name": "Example Student Living Ltd",
"email": "lettings@example-living.co.uk"
}
},
"cosigner": {
"first_name": "Wei",
"last_name": "Zhang",
"relationship": "parent",
"email": "wei.zhang@example.com",
"phone": "+8613900001234",
"date_of_birth": "1974-09-02",
"nationality": "CN",
"country_of_residence": "CN",
"address": {
"line1": "88 Century Avenue",
"city": "Shanghai",
"postal_code": "200120",
"country": "CN"
},
"locale": "zh-CN"
},
"documents": {
"tenant_identity": {
"type": "cn_resident_id",
"front": "file_5pXr9LmA2dQe7NzK",
"back": "file_Q2w8ErT6yU1iOp3L"
},
"proof_of_study": "file_Z7xC4vB9nM2aSd5F"
},
"fee": {
"collection": "partner"
},
"consents": {
"data_sharing": {
"accepted_at": "2026-11-19T09:12:55Z",
"ip_address": "203.0.113.24"
}
},
"metadata": {
"house_id": "13888",
"unit_id": "223515"
}
}'
Returns
Returns the application object.
Example response
{
"id": "app_3Nf7QwR1tY8uLk5H",
"object": "application",
"livemode": false,
"external_reference": "BK-2026-223515",
"status": "incomplete",
"applicant_type": "student",
"locale": "zh-CN",
"tenant": {
"first_name": "Yuxi",
"last_name": "Zhang",
"email": "yuxi.zhang@example.com"
},
"fee": {
"collection": "partner",
"amount": {
"amount": 50000,
"currency": "GBP"
},
"status": "unpaid"
},
"requirements": [
{
"code": "tenant.identity",
"party": "partner",
"status": "blocked",
"completable_via": [
"api",
"session"
]
},
{
"code": "tenant.proof_of_study",
"party": "tsg",
"status": "in_review",
"completable_via": [
"api",
"session"
]
},
{
"code": "cosigner.identity",
"party": "partner",
"status": "due",
"completable_via": [
"api",
"session"
]
},
{
"code": "fee.payment",
"party": "partner",
"status": "due",
"completable_via": [
"api"
]
},
{
"code": "tenant.signature",
"party": "tenant",
"status": "due",
"completable_via": [
"session"
]
},
{
"code": "cosigner.signature",
"party": "cosigner",
"status": "blocked",
"completable_via": [
"email_link"
]
},
{
"code": "landlord.confirmation",
"party": "landlord",
"status": "due",
"completable_via": [
"email_link"
]
},
{
"code": "landlord.signature",
"party": "landlord",
"status": "blocked",
"completable_via": [
"email_link"
]
}
],
"guarantee": null,
"created_at": "2026-11-19T09:16:03Z",
"updated_at": "2026-11-19T09:16:03Z"
}
List applications
Returns a list of applications.
Parameters
| Name | In | Description |
|---|---|---|
external_reference | query | Return only the application with this reference. |
status | query | One of incomplete, in_review, approved, declined, cancelled, expired. |
created_after | query | Only applications created at or after this time. |
Returns
Returns a list of application objects.
Retrieve an application
Retrieves an application.
Returns
Returns the application object.
Update an application
Updates an application by setting the values of the parameters passed. Parameters not provided are left unchanged.
You can update an application while its status is incomplete or in_review. tenancy, property, tenant and cosigner can't be updated after any party has signed, and tenancy and property can't be updated after the landlord has confirmed the tenancy details. To change them, cancel the application and create a new one. Updating a priced detail recalculates the fee, and isn't allowed after the fee is paid.
Request body
Nested objects take the same fields as in create.
Any subset of the fields accepted at creation, except external_reference, quote_id and consents.
| Field | Type | Description |
|---|---|---|
locale | enum | One of en, zh-CN. |
tenant | object | |
study | object | Required when applicant_type is student. |
property | object | |
tenancy | object | |
cosigner | object | The cosigner's details. |
documents | object | |
metadata | object |
Example request
curl https://api.thestudentguarantor.com/v1/applications/app_3Nf7QwR1tY8uLk5H \
-X PATCH \
-H "Authorization: Bearer $TSG_SECRET_KEY" \
-H "Idempotency-Key: 6f1c2a9e-8f0b-4c59-9d0e-2b7a54d0c1aa" \
-H "Content-Type: application/json" \
-d '{
"documents": {
"cosigner_identity": {
"type": "cn_resident_id",
"front": "file_A1s2D3f4G5h6J7k8",
"back": "file_L9k8J7h6G5f4D3s2"
}
}
}'
Returns
Returns the application object. Returns an error if the application is approved, declined, cancelled or expired, or if the update isn't allowed in its current state.
Cancel an application
Cancels an application. You can cancel an application while its status is incomplete or in_review. Cancelling invalidates its sessions.
Request body
| Field | Type | Description |
|---|---|---|
reason | enum | One of booking_cancelled, tenant_request, duplicate, other. |
note | string |
Example request
curl https://api.thestudentguarantor.com/v1/applications/app_3Nf7QwR1tY8uLk5H/cancel \
-X POST \
-H "Authorization: Bearer $TSG_SECRET_KEY" \
-H "Idempotency-Key: 6f1c2a9e-8f0b-4c59-9d0e-2b7a54d0c1aa" \
-H "Content-Type: application/json" \
-d '{
"reason": "booking_cancelled"
}'
Returns
Returns the application object with a status of cancelled. Returns an error if the application is already approved.
Confirm a fee you collected
Confirms that you've collected the fee from the tenant. Satisfies the fee.payment requirement. The application's fee.collection must be partner. If the fee is no longer fee.amount, the request is rejected with 409 fee_changed and nothing is recorded.
Request body
| Field | Type | Description |
|---|---|---|
amountrequired | object | |
amount.amountrequired | integer | The amount in the currency's smallest unit. 50000 is £500.00. |
amount.currencyrequired | string | ISO 4217 code. Fees are always GBP. |
paid_atrequired | date-time | When the tenant's payment succeeded. |
payment_referencerequired | string | Your order or transaction ID, shown on statements. |
collected | object | What you charged the tenant, if not in pounds sterling. |
collected.amountrequired | integer | The amount in the currency's smallest unit. 50000 is £500.00. |
collected.currencyrequired | string | ISO 4217 code. Fees are always GBP. |
Example request
curl https://api.thestudentguarantor.com/v1/applications/app_3Nf7QwR1tY8uLk5H/fee/confirm \
-X POST \
-H "Authorization: Bearer $TSG_SECRET_KEY" \
-H "Idempotency-Key: 6f1c2a9e-8f0b-4c59-9d0e-2b7a54d0c1aa" \
-H "Content-Type: application/json" \
-d '{
"amount": {
"amount": 50000,
"currency": "GBP"
},
"paid_at": "2026-11-19T09:21:44Z",
"payment_reference": "ORD-99120045",
"collected": {
"amount": 462500,
"currency": "CNY"
}
}'
Returns
Returns the application object with a fee.status of paid. Returns an error if amount differs from fee.amount.
15.5Sessions
A session authenticates one tenant in the embedded component for one application.
POST /applications/{application_id}/sessions
The session object
| Field | Type | Description |
|---|---|---|
id | string | |
object | string | Always session. |
application_id | string | |
mode | enum | One of embedded, redirect. |
client_secret | string | Secret used to mount the embedded component. |
url | uri | The hosted page for redirect mode. |
expires_at | date-time |
Create a session
Creates a session for an application. Sessions expire after 60 minutes. Creating a session invalidates the application's earlier sessions.
Request body
| Field | Type | Description |
|---|---|---|
mode | enum | embedded: for the JavaScript component. redirect: the tenant is sent to url. Default embedded. |
locale | enum | Overrides the application's locale for this session. One of en, zh-CN. |
return_url | uri | Where the tenant is sent when they finish or leave. Required for redirect. We append application_id and session_status (completed or exited). |
Example request
curl https://api.thestudentguarantor.com/v1/applications/app_3Nf7QwR1tY8uLk5H/sessions \
-X POST \
-H "Authorization: Bearer $TSG_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"mode": "embedded",
"locale": "zh-CN",
"return_url": "https://www.example-platform.com/bookings/BK-2026-223515/guarantee"
}'
Returns
Returns the session object. Returns an error if no requirement can be completed in a session.
Example response
{
"id": "sess_9Tg4HbN6mJ2kLp8Q",
"object": "session",
"application_id": "app_3Nf7QwR1tY8uLk5H",
"mode": "embedded",
"client_secret": "sess_9Tg4HbN6mJ2kLp8Q_secret_x7Vq2ZcR5tYw8Ub1",
"url": "https://app.thestudentguarantor.com/embed/session#sess_9Tg4HbN6mJ2kLp8Q_secret_x7Vq2ZcR5tYw8Ub1",
"expires_at": "2026-11-19T10:17:10Z"
}
15.6Guarantees
A guarantee is created when an application is approved.
GET /guarantees
GET /guarantees/{guarantee_id}
GET /guarantees/{guarantee_id}/certificate
GET /guarantees/{guarantee_id}/agreement
POST /guarantees/{guarantee_id}/end
The guarantee object
| Field | Type | Description |
|---|---|---|
id | string | |
object | string | Always guarantee. |
livemode | boolean | |
reference | string | The guarantee reference, in the form TSG-YYYY-XXXXXXXX. |
status | enum | active: in force. ended: the cover period has finished or the guarantee was ended early. cancelled: ended before the tenancy started. |
application_id | string | |
external_reference | string | |
tenant | object | |
tenant.first_name | string | |
tenant.last_name | string | |
property | object | |
property.line1 | string | |
property.line2 | string | |
property.city | string | |
property.postcode | string | |
property.country | string | |
cover | object | |
cover.start_date | date | |
cover.end_date | date | |
cover.monthly_rent_share | object | |
cover.monthly_rent_share.amount | integer | The amount in the currency's smallest unit. 50000 is £500.00. |
cover.monthly_rent_share.currency | string | ISO 4217 code. Fees are always GBP. |
refund | object or null | Present after a guarantee is ended early or cancelled. |
refund.amount | object | |
refund.amount.amount | integer | The amount in the currency's smallest unit. 50000 is £500.00. |
refund.amount.currency | string | ISO 4217 code. Fees are always GBP. |
refund.status | enum | One of pending, credited, paid. |
verify_url | uri | Public verification page for the guarantee. |
metadata | object | |
issued_at | date-time | |
ended_at | date-time |
List guarantees
Returns a list of guarantees.
Parameters
| Name | In | Description |
|---|---|---|
status | query | One of active, ended, cancelled. |
external_reference | query |
Returns
Returns a list of guarantee objects.
Retrieve a guarantee
Retrieves a guarantee.
Returns
Returns the guarantee object.
Example response
{
"id": "gua_6Yh2JmK9pL4nB7vC",
"object": "guarantee",
"livemode": false,
"reference": "TSG-2026-7KQ4M9XZ",
"status": "active",
"application_id": "app_3Nf7QwR1tY8uLk5H",
"external_reference": "BK-2026-223515",
"tenant": {
"first_name": "Yuxi",
"last_name": "Zhang"
},
"property": {
"line1": "Flat 218, Tower Building",
"line2": "12 Example Street",
"city": "London",
"postcode": "E1 6LT",
"country": "GB"
},
"cover": {
"start_date": "2026-10-24",
"end_date": "2027-07-10",
"monthly_rent_share": {
"amount": 140800,
"currency": "GBP"
}
},
"verify_url": "https://app.thestudentguarantor.com/g/TSG-2026-7KQ4M9XZ",
"issued_at": "2026-11-19T09:31:27Z"
}
Download the certificate
Retrieves the Rent Guarantee Certificate as a PDF.
Returns
Returns the PDF with a content type of application/pdf.
Download the signed agreement
Retrieves the signed guarantee agreement as a PDF.
Returns
Returns the PDF with a content type of application/pdf.
End a guarantee early
Ends a guarantee before its cover.end_date. The refund is calculated and returned in refund with a status of pending until it's processed. Repeating the request with the same parameters returns the same guarantee.
Request body
| Field | Type | Description |
|---|---|---|
end_daterequired | date | The last day of the tenancy. |
reasonrequired | enum | One of booking_cancelled, tenancy_ended_early, tenant_request, other. |
note | string |
Example request
curl https://api.thestudentguarantor.com/v1/guarantees/gua_6Yh2JmK9pL4nB7vC/end \
-X POST \
-H "Authorization: Bearer $TSG_SECRET_KEY" \
-H "Idempotency-Key: 6f1c2a9e-8f0b-4c59-9d0e-2b7a54d0c1aa" \
-H "Content-Type: application/json" \
-d '{
"end_date": "2027-03-31",
"reason": "tenancy_ended_early"
}'
Returns
Returns the guarantee object. If end_date is in the future, status stays active and cover.end_date is updated. Any refund is in refund.
15.7Webhooks
Webhook endpoints receive events. Events are also available from the API for 30 days.
POST /webhook_endpoints
GET /webhook_endpoints
DELETE /webhook_endpoints/{webhook_endpoint_id}
GET /events
The webhook endpoint object
| Field | Type | Description |
|---|---|---|
id | string | |
object | string | Always webhook_endpoint. |
url | uri | |
events | array of enum | One of application.created, application.requirements_updated, application.in_review, application.approved, application.declined, application.cancelled, application.expired, fee.paid, fee.refunded, guarantee.issued, guarantee.updated, guarantee.ended. |
status | enum | One of enabled, disabled. |
secret | string | Returned only when the endpoint is created. |
description | string or null | |
created_at | date-time |
The event object
| Field | Type | Description |
|---|---|---|
id | string | |
object | string | Always event. |
type | enum | One of application.created, application.requirements_updated, application.in_review, application.approved, application.declined, application.cancelled, application.expired, fee.paid, fee.refunded, guarantee.issued, guarantee.updated, guarantee.ended. |
livemode | boolean | |
created_at | date-time | |
data | object | |
data.object | object | The application or guarantee as it was when the event happened, in the same shape the API returns. |
Create a webhook endpoint
Creates a webhook endpoint.
Request body
| Field | Type | Description |
|---|---|---|
urlrequired | uri | Must be HTTPS on port 443. |
events | array of enum | The event types to deliver. Omit to receive all of them. One of application.created, application.requirements_updated, application.in_review, application.approved, application.declined, application.cancelled, application.expired, fee.paid, fee.refunded, guarantee.issued, guarantee.updated, guarantee.ended. |
description | string |
Example request
curl https://api.thestudentguarantor.com/v1/webhook_endpoints \
-X POST \
-H "Authorization: Bearer $TSG_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://api.example-platform.com/hooks/tsg",
"events": [
"application.requirements_updated",
"application.approved",
"application.declined",
"guarantee.issued"
]
}'
Returns
Returns the webhook endpoint object with its secret. The secret isn't returned again.
Example response
{
"id": "whk_2Bv5NmQ8wE1rT4yU",
"object": "webhook_endpoint",
"url": "https://api.example-platform.com/hooks/tsg",
"events": [
"application.requirements_updated",
"application.approved",
"application.declined",
"guarantee.issued"
],
"status": "enabled",
"secret": "whsec_Jx4mP9qLs2Vt7RzKc8Bn1WdY",
"created_at": "2026-11-19T08:02:11Z"
}
List webhook endpoints
Returns a list of your webhook endpoints.
Returns
Returns a list of webhook endpoint objects.
Delete a webhook endpoint
Deletes a webhook endpoint.
Returns
Returns an empty response.
List events
Returns a list of events from the last 30 days.
Parameters
| Name | In | Description |
|---|---|---|
type | query | One of application.created, application.requirements_updated, application.in_review, application.approved, application.declined, application.cancelled, application.expired, fee.paid, fee.refunded, guarantee.issued, guarantee.updated, guarantee.ended. |
created_after | query |
Returns
Returns a list of event objects.
15.8Sandbox
Endpoints available only in the sandbox.
POST /test/applications/{application_id}/simulate
Simulate an outcome
Completes requirements or the review on a sandbox application.
Request body
| Field | Type | Description |
|---|---|---|
actionrequired | enum | tenant_completes_session satisfies every requirement whose party is tenant. cosigner_signs, landlord_confirms and landlord_signs satisfy the matching requirement. documents_accepted and documents_rejected settle requirements that are in_review. approve and decline settle an application that is in_review. |
Example request
curl https://api.thestudentguarantor.com/v1/test/applications/app_3Nf7QwR1tY8uLk5H/simulate \
-X POST \
-H "Authorization: Bearer $TSG_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"action": "tenant_completes_session"
}'
Returns
Returns the application object. Returns 404 in production.