Skip to main content
POST
Create an in-app survey session

Authorizations

Authorization
string
header
required

Bearer API key. Secret server keys start with gt_live_; client-safe browser keys start with gt_pub_ (write-only, origin-pinned). Create and scope keys in Settings → API Keys.

Path Parameters

id
string<uuid>
required

The survey's UUID.

Body

application/json

Field names follow the code: contactId is a person id and accountId is a company id.

contactId
string<uuid>
required

The signed-in person's id in GainTrace.

accountId
string<uuid>
required

The id of that person's company. It must match the person.

parentOrigin
string<uri>
required

The exact origin of the page that will show the survey, such as https://app.example.com. It must be listed in the survey's settings.inApp.allowedOrigins.

Maximum string length: 255
mode
enum<string>
default:survey

test skips eligibility rules and records nothing, so you can preview the survey.

Available options:
survey,
test
context
object

What the person is doing right now. Send it when the survey has page rules or a trigger under settings.inApp.targeting.

subject
object

The deal, ticket, plan or custom record this survey asks about. Responses to the embed carry it as their subject. The record must belong to the same Company as the person. The record a response is about: a deal, ticket, plan or custom record. Name it by its GainTrace id, or, for a deal or ticket, by the id it has in your CRM or help desk (externalId, with source when more than one connection holds that id). For a custom record, send the data model's model slug and the record's externalId. The record must exist, must not be archived, and must belong to the same Company as the person.

lang
string

A language tag such as es or pt-BR. The survey shows in this language when it has a translation for it. It wins over the person's locale or language trait and the browser.

Maximum string length: 35

Response

The session decision.

data
object
required