How the Sandbox Differs from Live
Send sandbox requests tohttps://api.sandbox.theguarantors.com with a sandbox API key. Live requests go to https://api.theguarantors.com, and keys only work in the environment they were issued for. See Environments.
Beyond that, the sandbox differs from live in three ways:
- Webhook events are triggered by you. Within the sandbox, we provide developers with complete control over the timing of webhook event triggers through the
/v1/webhooks/triggerendpoint. This endpoint allows developers to manually and programmatically simulate the occurrence of various webhook events, thereby facilitating robust and repeatable testing of their event-handling logic. See Triggering Events in Sandbox. - Invite links are non-functional. Invite links returned by the sandbox
POST /v1/invitesendpoint will not send real emails or allow tenants to complete an application. They are intended solely for testing purposes, to allow developers to validate their integration before going live. - Bond documents are a sample. Bond
document_linkURLs returned in the sandbox always return the same sample PDF, whichever bond they belong to.
Pre-Seeded Sandbox Entities
The Sandbox environment comes preset with Properties, Units and Coverage Levels that developers can use to start testing invites and applications immediately.
On the pre-seeded properties, each
coverage_level resolves to the following coverage:
If an invite includes a
free_rent_amount or prepaid_rent_amount, its Lease Guarantee is reduced by the months of rent they cover, (free_rent_amount + prepaid_rent_amount) / monthly_rent, down to a minimum of 0. For example, a medium invite with one month of free rent gets 5 months of Lease Guarantee.
These IDs can be used as inputs to the sandbox POST
/v1/invites and PATCH /v1/invites/:id endpoints.
Triggering Events in Sandbox
In the sandbox environment, you have complete control over webhook event timing through the/v1/webhooks/trigger endpoint. This allows you to manually trigger webhook events for testing purposes. See Webhooks for the payloads and how they’re delivered.
To trigger a webhook event in sandbox, send a POST request to:
Request Body
The request body takes theevent_type to trigger and the ID of the entity it applies to. Which ID that is depends on the event type, as listed in Available Event Types for Sandbox below. For example, application.status.started creates the application, so it takes the invite_id of the invite to convert:
Available Event Types for Sandbox
applicant.status.started(requiresinvite_recipient_id)applicant.status.submitted(requiresinvite_recipient_id)application.status.started(requiresinvite_id)application.status.submitted(requiresapplication_id)application.status.pending(requiresapplication_id)application.status.approved(requiresapplication_id)application.status.denied(requiresapplication_id)bond.status.issued(requiresapplication_id)bond.status.canceled(requiresbond_id)
not_started → started → submitted) and cascades to the application where appropriate:
applicant.status.startedfor a recipient whose invite has no application yet creates the application and emitsapplication.status.startedin addition toapplicant.status.startedfor that recipient. The other recipients on the invite remainnot_started.applicant.status.startedfor a recipient whose application already exists moves only that applicant tostarted.applicant.status.submittedmoves that applicant tosubmitted. If it is the last applicant on the application still outstanding, the application also moves tosubmittedand anapplication.status.submittedevent is emitted.- The application-level events emit applicant events too:
application.status.started(with aninvite_id) emits anapplicant.status.startedevent for every recipient on the invite, andapplication.status.submitted(with anapplication_id) emits anapplicant.status.submittedevent for every applicant that had not already submitted. You can use them as shortcuts instead of triggering an event for each applicant, but the two approaches can’t be mixed freely:application.status.startedreturns a 409 once an application exists for the invite, andapplication.status.submittedrequires every applicant to have at least started, so it returns a 400 if any recipient is stillnot_started.
application.status.canceled cannot be sent through the trigger endpoint. To test it, cancel the application with POST /v1/applications/:id/cancel, which sends the webhook to your subscribed endpoint. See Canceling an Application.
To cancel an issued bond, trigger bond.status.canceled through POST /v1/webhooks/trigger with the bond’s bond_id, which is returned when you trigger bond.status.issued and by GET /v1/applications/:application_id/bonds. This also cancels the bond’s application and sends application.status.canceled along with bond.status.canceled:
POST /v1/invites/:id/cancel or amend it with the endpoints in Amending an Invite, which send the webhooks to your subscribed endpoint.
Response
The endpoint returns the webhook payload that would be sent to subscribers:Testing Workflow
- Create an invite using the
POST /v1/invitesendpoint - Trigger application started event using the
POST /v1/webhooks/triggerendpoint with the invite ID (or trigger applicant started for each invite recipient, the first one creates the application) - Trigger application submitted event using the
POST /v1/webhooks/triggerendpoint with the application ID (or trigger applicant submitted for each invite recipient, the last one moves the application tosubmitted) - Trigger application approved event using the
POST /v1/webhooks/triggerendpoint with the application ID - Trigger bond issued event using the
POST /v1/webhooks/triggerendpoint with the application ID
POST /v1/applications/:id/cancel at any step before triggering bond issued.
To test a denial, follow steps 1 through 3 above, then trigger application.status.denied with the application ID instead of application approved. A denied application can’t be issued a bond, so triggering bond issued for it returns a 400.