Authentication
The Duro GraphQL API uses Bearer token and API key (via x-api-key header) authentication. All API requests must include an authorization token in the header.
Which one do you need?
Duro has two authentication mechanisms, and they serve different callers:
A script, integration, or backend service acting as your organization
An API key in the x-api-key header
This page
An application signing in as a human being — your own UI, a desktop tool, a CAD plugin
The account APIs: sign up, sign in, sessions, SSO
Obtaining an API Authentication Token
To get started with the Duro API, you'll need to:
Create a Duro account at durohub.com
Navigate to your account settings
Generate an API token from the Developer section
Your URL to get an API key is:
https://durohub.com/org/@<your org slug>/libs/<your library slug>/settings/api-keys

Using the Token
Include your API token in all requests using the x-api-key header:
Token Security
Never share your API tokens
Rotate tokens regularly
Use different tokens for development and production
Store tokens securely in environment variables
Checking the Authenticated User
To confirm a token is valid and inspect the current identity, query me under the user namespace:
hasOrganizations is a non-null Boolean that returns true when the authenticated user belongs to at least one organization. It is useful in onboarding flows to decide whether to prompt the user to create or join an organization before making organization-scoped calls.
A valid token is necessary but not sufficient: me.permitted reports whether the identity is allowed to use Duro at all. When it is false, every data operation is refused with ACCESS_NOT_PERMITTED until the account is invited or approved — check it before issuing further requests.
See Current User for the full set of fields me returns.
Selecting an Organization
Most operations are scoped to a single organization, which you select with the x-organization header. It accepts either form:
Duro validates the value against the authenticated caller's organization memberships on every request. A UUID or slug you are not a member of is rejected rather than silently falling back to another organization, so the header is safe to drive directly from user input such as an organization picker.
Never rely on a default. When a user belongs to several organizations, their membership list has no defined order, so omitting the header leaves the organization Duro picks for the request unpredictable. This is why document uploads now take their organization from this header instead of from the uploader's memberships.
Membership records returned with the authenticated user include organization.slug alongside the organization's id, so you can render a picker and build the header value without a second lookup — prefix the slug with @ to send the slug form:
Next Steps
Learn how to make your first API call in the Hello World guide.
To authenticate people rather than services — signup, sign-in, sessions, SSO, and password management — see Account Management.
Last updated
Was this helpful?