Skip to content
GbàlejòDocs

Visits

Cancel a visit

POST/api/v1/visits/{visitId}/cancel
Scope: visits:write

Cancel a visit that has not started, or the rest of a repeating one. A visitor who was sent a pass is told by email.

Example request

curl
curl -X POST https://api.gbalejo.com/api/v1/visits/8b0e7c1a-4f2d-4b9e-a6c3-2d1f5e9a7b40/cancel \
  -H "Authorization: Bearer $GBALEJO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "reason": "The review moved to next week."
}'
JavaScript
const response = await fetch('https://api.gbalejo.com/api/v1/visits/8b0e7c1a-4f2d-4b9e-a6c3-2d1f5e9a7b40/cancel', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.GBALEJO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    reason: 'The review moved to next week.',
  }),
});
// Problems come back as application/problem+json: type, title, status, detail.
if (!response.ok) throw new Error((await response.json()).detail);
const result = await response.json();

Example response

200 OK
JSON
{
  "cancelled": 1
}

Path parameters

visitIdrequired

string (uuid)

The visit’s id.

Request body

application/json

reason

string or null, at most 300 characters

Why, kept in the visit’s history.

series

boolean, default false

For a visit that repeats: also cancel every later visit in the series that has not started.

Responses

200 OK

How many visits were cancelled.

cancelled

integer

How many visits were cancelled.

Errors

The id in the path is not a UUID.

No key was sent, or it is mistyped or unknown.

The key has been revoked.

The key has passed its expiry date.

The organisation’s plan does not include the API (feature: "api").

A payment is overdue: the organisation can read but not change anything until it is paid.

Gbàlejò has suspended the organisation.

The key does not have visits:write.

There is no such visit in the organisation.

The visit has started or ended: only INVITED and EXPECTED visits can be cancelled.

Someone changed the visit at the same moment: read it again.

A field is missing or not valid: errors lists each one with its path.

The key has made its requests for this minute (Retry-After says when).