Generate a survey link
const url = 'https://api.pristo.io/v1/links/generate/AbCdEfGhIjKlMnOpQrStUv';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"expiresInMinutes":10080,"language":"en","isReusable":false,"title":"Order 1042","customFields":{"order_id":"1042","channel":"chat"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.pristo.io/v1/links/generate/AbCdEfGhIjKlMnOpQrStUv \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "expiresInMinutes": 10080, "language": "en", "isReusable": false, "title": "Order 1042", "customFields": { "order_id": "1042", "channel": "chat" } }'Creates a link to a questionnaire on https://go.pristo.io. By default the link is single-use and
never expires. A single-use link belongs to one response: opening it again continues that response,
and after the respondent submits it opens a thank-you page. A reusable link starts a new response
each time it opens. The questionnaire opens in its own default language; language is stored with
the link and used for the expired and thank-you pages. Every body field is optional, but the body is
required: send {} to use every default.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The questionnaire’s 22-character short ID, shown on the questionnaire’s Share page in the manager app (see https://docs.pristo.io/cx/api/generate-a-survey-link). A full UUID is rejected.
Example
AbCdEfGhIjKlMnOpQrStUvRequest Bodyrequired
Section titled “Request Bodyrequired”object
Minutes until the link expires, up to 1,576,800 (3 years). Omit it for a link without an expiry date.
Two-letter ISO 639-1 code stored with the link. It sets the language of the expired and thank-you pages and is shown in the response details. The questionnaire itself opens in its own default language.
Set to true to let the link collect a new response each time it opens.
A label for the link, shown in the response details.
Your own values, such as an order number. Values must be strings; keys and values are at most 50 characters each. They appear in the response details in the manager app.
object
Example
{ "expiresInMinutes": 10080, "language": "en", "isReusable": false, "title": "Order 1042", "customFields": { "order_id": "1042", "channel": "chat" }}Responses
Section titled “Responses”The link was created.
object
Example
{ "linkId": "11111111-2222-3333-4444-555555555555", "url": "https://go.pristo.io/l/AbCdEfGhIjKlMnOpQrStUv"}The request is invalid. Plain-text messages:
provided surveyId is not valid:prjIdis not a 22-character short ID.Payload size exceeds the maximum allowed size of 10000 bytesexpiresInMinutes must be between 1 and 1576800language must be exactly 2 characters long (iso 639-1)title must be at most 50 characters longcustomField values must be stringscustomField keys and values must be at most 50 characters longValue is invalid: theX-API-Keyvalue is shorter than 24 characters, orlanguageis not an ISO 639-1 code.
A missing body, invalid JSON or a field of the wrong JSON type returns a JSON problem body instead.
Example
expiresInMinutes must be between 1 and 1576800An RFC 9457 problem body.
object
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "traceId": "example"}The X-API-Key header is missing or empty, or the key does not match an active key (wrong, deactivated or deleted).
An RFC 9457 problem body.
object
Example
{ "title": "Unauthorized", "status": 401}No questionnaire with this ID in the API key’s account, or the questionnaire was deleted. The message contains the questionnaire’s UUID.
Example
project with id 11111111-2222-3333-4444-555555555555 not foundThe Content-Type header is not application/json.
An RFC 9457 problem body.
object
Example
{ "title": "Unsupported Media Type", "status": 415}The server could not create the link. The JSON problem body’s detail is
project does not have a form associated or a problem occurred, please try again later.
An unexpected failure returns the plain-text body Internal server error.
An RFC 9457 problem body.
object
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "traceId": "example"}Example
Internal server error