Skip to content

Guest API: Visitors

A website’s readers before they sign in, and their secret.

What it doesRoute
Sign a visitor outDELETE /guest/v1/visitor
Make a visitorPOST /guest/v1/visitors
Merge a visitor into the userPOST /guest/v1/visitors/merge

DELETE /guest/v1/visitor

Ends the visitor’s secret, with the secret as the token: the website signed its reader out, and the next time they need one a new visitor is made. 409 for a user’s token.

Needs: the app key (X-CRM-App-Key) and the signed-in user’s token (Authorization: Bearer …), or their id for an app with unverified sign-in. See From a website or web app.

Answers

StatusBodyMeaning
204noneDone, with nothing to say
400problemThe request could not be read: the problem names the field.
401problemNo credential, or one that is not right.
403problemRefused: the app is switched off, or this is not allowed.
409problemRefused as things stand: the problem says why.
429problemToo many requests: wait for Retry-After.

POST /guest/v1/visitors

A reader of one of the app’s websites who has not signed in, for an app whose staff let visitors in: sent with the app’s key, from a page on one of its web origins, and no token. The answer’s secret is the visitor’s token on every other guest route until they sign out, are merged into their user, or leave it unused for 90 days. 401 visitors_off for an app that lets none in; 429 past a few a minute from one address.

Needs: the app key (X-CRM-App-Key) and the signed-in user’s token (Authorization: Bearer …), or their id for an app with unverified sign-in. See From a website or web app.

Body (application/json): VisitorBody

FieldTypeDescription
languagestringThe browser’s language (a BCP 47 tag), for the help bot and the help center; left out when it does not say.
platform (always)DevicePlatform (one of ios, android, web)Where the visitor is reading: PlatformWeb from a page on one of the app’s web origins, or PlatformAndroid or PlatformIOS from a phone app, with no Origin, on an app that lets phone apps’ visitors in (PurrCRM.GuestAuth.AppVisitors).

Answers

StatusBodyMeaning
201VisitorMade
400problemThe request could not be read: the problem names the field.
401problemNo credential, or one that is not right.
403problemRefused: the app is switched off, or this is not allowed.
429problemToo many requests: wait for Retry-After.

POST /guest/v1/visitors/merge

The reader signed in: with the user’s token, and the visitor’s secret the browser kept, what they wrote, were sent and did as a visitor becomes the user’s, in the same conversations and tickets, and the secret ends. Call it before any other request as the user. merged is false for a secret that has ended or is nobody’s; the same visitor merged into the same user again is merged and moves nothing more. 409 visitor_merged_elsewhere for a visitor merged into another user, and for a visitor’s own secret as the token.

Needs: the app key (X-CRM-App-Key) and the signed-in user’s token (Authorization: Bearer …), or their id for an app with unverified sign-in. See From a website or web app.

Body (application/json): VisitorMergeBody

FieldTypeDescription
visitor_secret (always)string

Answers

StatusBodyMeaning
200VisitorMergeOK
400problemThe request could not be read: the problem names the field.
401problemNo credential, or one that is not right.
403problemRefused: the app is switched off, or this is not allowed.
409problemRefused as things stand: the problem says why.
429problemToo many requests: wait for Retry-After.