GraphQL API
GraphQL is a query language for APIs. GraphQL provides a complete and understandable description of the data in an API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools.
Access
To access the Edgewise API, you'll need an access token, which you can generate from your profile (Account > API Access Tokens). Make sure to write down the access token when it is created, as we do not store it, and you will not be able to retrieve it again.
Authentication
All requests go to a single API endpoint: https://api.edgewise.io/graphql
You need to include the Authorization
header, with a Bearer [your access token]
value.
Usage
To use the GraphQL API, you can send a POST request to the API endpoint with a JSON body containing the query. All requests must be made over HTTPS using POST.
Here are some examples:
# curl: example using viewer query
curl -X POST https://api.edgewise.io/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer [your access token]" \
-d '{"query": "query Viewer { viewer { id fullName } }"}'
// javascript: example using Leads query with variables
const query = `
query Leads($filters: LeadsFilter, $first: Int) {
leads(filter: $filters, first: $first) {
id
name
email
phone
status
}
}
`
const variables = {
filters: {
status: ['NEW'],
},
first: 10,
}
fetch('https://api.edgewise.io/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer [your access token]'
},
body: JSON.stringify({ query, variables }),
})
.then(async (response) => {
const responseJson = await response.json()
})