API
Learn how to authenticate and access the Silkline GraphQL API. This guide covers creating API keys, exchanging them for JWT tokens, and making authenticated requests.
Silkline API Documentation
Getting Started
API access is granted through API keys. Each key is a clientId and clientSecret pair that your integration exchanges for a short-lived access token.
Ask Silkline to enable API keys for your organization. Once enabled, Organization Settings → API keys appears in your settings menu.
A user with the Create API Key permission (held by the Admin role by default) creates a key on that page and gives it a name.
Copy the
clientIdandclientSecretshown at creation. The secret is displayed once and cannot be retrieved later; if it is lost, create a new key and delete the old one.
See API Keys for the full guide to creating and deleting keys.
Authentication
Step 1: Exchange Credentials for JWT Token
Use your credentials to obtain a JWT token from the token endpoint:
Production:
curl -X POST https://app.silkline.ai/api/oauth/token \
-H "Content-Type: application/json" \
-d '{
"client_id": "<clientId>",
"client_secret": "<clientSecret>",
"grant_type": "client_credentials"
}'Development:
The endpoint also accepts a form-encoded body (application/x-www-form-urlencoded) and HTTP Basic authentication, where the client ID and secret are sent in the Authorization header instead of the body:
Response:
Important Notes:
No
audienceparameter is requiredTokens are valid for 24 hours. As much as possible, please reuse the same token for multiple requests rather than generating a new token for each API call
Your token is scoped to your organization with the same permissions as an admin user
Deleting a key stops it from obtaining new tokens. A token already issued stays valid until it expires
Step 2: Access the GraphQL API
Use your token to make GraphQL requests:
Replace <access_token> with the token received in Step 1.
Rate limits
Each API key can make up to 3,000 requests per minute, counted over a rolling one-minute window. The limit applies to the key alone: other keys and users in your organization are unaffected.
A request over the limit returns HTTP 200 with a GraphQL error whose extensions.code is rate-limit-exceeded:
When you receive this error, wait and retry with exponential backoff. Spread bulk syncs over time rather than sending them in a single burst.
Query limits
Each request made with an API key must stay within these limits:
Depth: nested fields that select other fields, counting the top-level field as 1
8
depth-limit-exceeded
Nodes: fields in the query that select other fields
150
node-limit-exceeded
Operations in one batched request
10
batch-limit-exceeded
Execution time
30 seconds
time-limit-exceeded
Fields that return a plain value, such as id or name, don't count toward depth or nodes. A request over a limit returns a GraphQL error with the code above. A query over the depth or node limit is rejected before it runs. Split it into smaller queries, or paginate with limit and offset.
Example: export your security settings
This query returns your organization's security-relevant settings, its administrators, its API keys, its published Public Files, and its custom file storage. Compare the result with the secure defaults in the Secure Configuration Guide, and keep the JSON response as a record of each review. A defaultRoleId of null means new members get the Viewer role.
Example: compare your settings with the secure defaults
The secure defaults are published as JSON at https://app.silkline.ai/.well-known/fedramp/secure-configuration-guide. The document includes the query above as settingsQuery. Each entry in defaults lists checks: the response field to read (apiField) and how to compare it (comparison). Entries without checks need a manual review.
This script runs the query and prints each check as true (matches the default), false (differs), or manual. It stops with an error if the query fails, for example when the access token has expired:
A false result is not always a problem. Record the approved exception, as described in the guide.
Last updated
Was this helpful?