GraphQL

Our API primarily speaks GraphQL (GQL, for short). While explaining how GraphQL works is beyond the scope of this guide, there are excellent resources available on the interwebs.

Here we will introduce the basic request-response structure of the Sentiance GraphQL API.

Endpoint and Authorization

Our default GraphQL endpoint lives at POST https://api.sentiance.com/v2/gql and accepts the same bearer token based authorization as our REST endpoints.

We adhere to the GraphQL specification but do not support multiple operation types.

Since it is possible for a single HTTP request to encompass multiple GraphQL queries with some of them succeeding and some of them failing, the endpoint always returns a 200 OK, unless something severe enough happens on the server-side to guarantee failure of the entire response (such as a 500 status code). After checking for the 200 status code, please also check the body of the response for data and error properties.

GQL Request

POST https://api.sentiance.com/v2/gql

Headers

Name
Type
Description

Authorization

string

Bearer

Content-Type

string

application/json

Request Body

Name
Type
Description

query

string

The GraphQL query.

variables

object

A flat JSON object describing the variables to substitute in the query.

Introspection

While you can always discover and play around with Graphql in our Data Explorers, you might wish to programatically introspect our Schema for your own tools to parse. You can do so by firing off an Introspection Query.

Examples

Some examples of various GQL queries with example response are presented here. With GraphQL you can fetch as much or as little as you wish.

Moment Definitions

Alpha Segments

User Timeline Query

User Moment History

Last updated