API overview
What the Prescient GraphQL API returns, where to send a request, and which page to read for each task.
The Prescient GraphQL API gives your own tools read access to the modeled metrics and the reported spend of your workspace. The API has four queries and no mutations, so a request cannot change data in Prescient.
What can you read?
Section titled “What can you read?”Each query has a reference page with its arguments, its return type, and an example.
modeledMetricsreturns the modeled revenue, customers, leads, and subscriptions for each campaign and day.reportedMetricsreturns the reported spend for each campaign and day.modelsreturns the models of your workspace and the unit of each one.channelNamesreturns the source names of the channels that you have in use.
The Types page lists each object, enum, and scalar that the queries use.
Where do you send a request?
Section titled “Where do you send a request?”Send each request as an HTTP POST with a JSON body to one endpoint.
POST https://api.prescient-ai.io/graphqlAuthorization: apikey YOUR_API_KEYContent-Type: application/jsonThe API has no version number in the URL. The Changelog lists each change to the schema and to the behavior.
What do you need before you start?
Section titled “What do you need before you start?”You need an API key. An Admin creates the key on the API keys tab of the Settings page. See Create and revoke an API key.
A key reads the data of one workspace. If the key has a channel scope, the key reads only the channels in that scope. See Authentication.
Where do you go next?
Section titled “Where do you go next?”- To send a request in a few minutes, follow Make your first request.
- To copy all the rows of a date range, see Pull modeled metrics for a date range and Pull reported spend for a date range.
- To keep a copy of the data current, see Sync only the rows that changed.
- To handle a failed request, see Errors and Limits.
Can a tool read the schema?
Section titled “Can a tool read the schema?”Yes. The endpoint answers a GraphQL introspection query, so a GraphQL client can load the schema from the endpoint. This site also has the schema as one file at /api/schema.graphql.