GraphQL API
Learn how to integrate with our GraphQL API to access and manipulate data efficiently.
AdSigner exposes a GraphQL API that allows you to code custom integrations.
Access tokens
We recommend authenticating with access tokens, which can be generated on the access tokens page.
Access tokens are associated with your account and can be limited with scopes.
canViewUser
When an organization creates an user, it is associated with an account with the same email address. With this scope, you can view all user profiles associated with this account, and get data on all their associated resources, such as signatures.canEditUser
Can edit user profiles associated with the account.canViewOrganization
Provides read-only access to all organizations this account has permissions to view.canEditOrganization
Provides read and write access to all organizations this account has permissions to view and edit.canManageAccount
Allows you to manage your account, including creating and revoking access tokens and sessions.full
Provides all permissions.
GraphQL API reference
GraphQL API is self-documenting and accessible via
https://beta.adsigner.dev/graphql
You can explore the API and test queries and mutations using the GraphiQL interface, which is available below:
Explore GraphQL API
Most queries and mutations require you to be authenticated.
To authenticate in the GraphiQL interface, click on the "Headers" tab and add the following JSON, replacing <your-access-token> with a valid access token.
GraphQL Headers
{
"Authorization": "Bearer <your-access-token>"
}The following example uses Node.js to fetch all signatures in your organization and save them as HTML files.
Example
import fs from 'node:fs';
const graphqlEndpoint = 'https://www.adsigner.com/graphql';
// Create an access token with the appropriate scopes and replace the placeholder below.
const accessToken = 'YOUR_ACCESS_TOKEN_HERE';
// You can get your organization ID from the dashboard URL `/org/{organizationId}/...`
// or from the GraphQL API by querying the `organizations` field.
const organizationId = 'YOUR_ORGANIZATION_ID_HERE';
const response = await fetch(graphqlEndpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${accessToken}`,
},
body: JSON.stringify({
query: `
query($organizationId: ID!) {
organization(id: $organizationId) {
users {
nodes {
id
email
signatures {
id
html
}
}
}
}
}`,
variables: {
organizationId,
},
}),
});
const json = await response.json();
const users = json.data.organization.users.nodes;
for (const user of users) {
for (const signature of user.signatures) {
const filename = `signature-${signature.id}.html`;
await fs.promises.writeFile(filename, signature.html);
console.log(`Saved signature ${signature.id} for user ${user.email} to ${filename}`);
}
}