Skip to main content

Authentication

Every request to the Accord GraphQL API must include an API key. Keys are issued per-workspace by workspace admins.

Creating an API key

API keys are created from the Accord app:

  1. Click your avatar / profile picture in the bottom-left corner of Accord.
  2. Click Settings.
  3. Navigate to Workspace → API Keys.
  4. Click Create API Key.
  5. Give the key a descriptive name (for example, Snowflake sync (production)) so future-you knows what it's for.
  6. Click Create and copy the key immediately. For security, you won't be able to view the full key again after closing the dialog.

You can also reach this page directly at <workspace-slug>.inaccord.com/api-keys.

tip

Only workspace admins can create API keys. If you don't see the API Keys page, ask an admin in your workspace.

Using a key in requests

Send the key as a bearer token in the Authorization header on every request to https://api.inaccord.com/graphql:

POST /graphql HTTP/1.1
Host: api.inaccord.com
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{"query": "{ currentUser { id displayName } }"}

cURL

curl -X POST https://api.inaccord.com/graphql \
-H "Authorization: Bearer $ACCORD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"{ currentUser { id displayName } }"}'

JavaScript (fetch)

const res = await fetch('https://api.inaccord.com/graphql', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.ACCORD_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: '{ currentUser { id displayName } }',
}),
});
const { data, errors } = await res.json();

Scope of a key

A key acts within the workspace it was created in. The same Row-Level Security rules that apply to in-app sessions apply to API key requests. A key cannot read or change data its workspace wouldn't otherwise be able to.

Managing keys

Return to Workspace → API Keys at any time to view existing keys or delete a key that should no longer be used. Deletion is immediate. To rotate a key without downtime, create the replacement first, switch your client to the new key, then delete the old one.

Where to go next