DocuTrust supports three authentication methods. Choose the one that fits your integration pattern.Documentation Index
Fetch the complete documentation index at: https://docs.spitshake.io/llms.txt
Use this file to discover all available pages before exploring further.
| Method | Header | Best for |
|---|---|---|
| API Token | X-Auth-Token: TOKEN | Server-side integrations, scripts, CI/CD pipelines |
| Session Cookie | Cookie: _docutrust_session=VALUE | Browser-based access after web login |
| JWT Bearer | Authorization: Bearer TOKEN | Embedded signing forms and template builders |
API Token (recommended)
API tokens are the primary way to authenticate server-side API calls. Each token is scoped, rotatable, and tied to a specific user account.Creating a token
Navigate to Settings > API in the DocuTrust dashboard and click Create Token. You can also create tokens programmatically.Using the token
Pass the token in theX-Auth-Token header with every request:
Available scopes
Scopes control which API operations a token can perform. Assign the minimum set of scopes your integration needs.| Scope | Allows |
|---|---|
templates:read | List and retrieve templates, download template documents and thumbnails |
templates:write | Create, update, clone, merge, and archive templates |
submissions:read | List and retrieve submissions, list and download documents |
submissions:write | Create submissions (single and bulk), archive submissions |
users:read | List and retrieve user accounts, view current user |
submissions:draft | Prepare draft submissions (create, update). No emails sent. |
submissions:send | Send submissions for signing (legally binding). Dispatches invitation emails. |
submissions:remind | Send signing reminders to pending submitters. |
submitters:write | Update submitter information and resend invitations. |
audit_events:read | Read the account-wide audit trail. |
A token without any scopes is rejected on all endpoints. Always assign at least one scope.
IP allowlisting
Restrict a token to a set of IP addresses or CIDR ranges. Requests from any other IP will receive a403 Forbidden response. Leave allowed_ips empty (or omit it) to allow requests from any IP.
Revoking a token
Revoke a token immediately when it is compromised or no longer needed:Listing tokens
Retrieve all tokens for your account. The full token value is never returned — only thetoken_prefix.
Session Cookie
When a user logs in through the DocuTrust web interface, the server sets a_docutrust_session cookie. This cookie authenticates all subsequent requests from the browser automatically.
Session cookies are primarily used by the DocuTrust frontend. They are useful if you are building a custom frontend that shares the same domain or if you need to make authenticated requests from browser JavaScript after a user has logged in.
How it works
- The user logs in at
https://spitshake.io/sign_inwith email and password (plus MFA if enabled). - The server returns a
Set-Cookie: _docutrust_session=VALUEheader. - The browser includes this cookie on all subsequent requests to the DocuTrust domain.
Session lifetime
- Sessions expire after 30 minutes of inactivity.
- Security events (password change, MFA disable, privilege escalation) immediately invalidate all active sessions for the affected user.
- Logging out destroys the session server-side.
JWT Bearer Token
JWT bearer tokens are designed for embedded components — signing forms and template builders rendered inside your application using an iframe or the DocuTrust JavaScript SDK.Generating a token
Request a short-lived JWT from the embed token endpoint. This call must be made server-side using an API token.Using the token
Pass the JWT in theAuthorization header:
Token properties
| Property | Value |
|---|---|
| Algorithm | HS256 |
| Expiry | 4 hours from creation |
| Renewable | No — generate a new token when the current one expires |
| Scope | Limited to the specific resource_type and resource_id |
JWT tokens can only access the specific resource they were created for. A token scoped to submission 187 cannot access submission 188.
OAuth 2.1 (Authorization Code + PKCE)
For connector directories and third-party AI agents. OAuth provides delegated access — users authorize your application without sharing their API token.Discovery
Flow
- Register your client via
POST /oauth/register(Dynamic Client Registration) or the admin UI at/oauth/applications - Redirect the user to
/oauth/authorizewithresponse_type=code,client_id,redirect_uri,scope,code_challenge(S256), andcode_challenge_method - Exchange the authorization code at
POST /oauth/tokenwithgrant_type=authorization_code,code,redirect_uri,client_id, andcode_verifier - Use the access token as
Authorization: Bearer <token>on any API or MCP endpoint - Refresh with
grant_type=refresh_tokenwhen the access token expires (1 hour)
Error responses
Authentication failures return standard HTTP error codes:| Status | Meaning | Common cause |
|---|---|---|
401 Unauthorized | Missing or invalid credentials | No token provided, token revoked, token expired, invalid JWT |
403 Forbidden | Valid credentials but insufficient permissions | Token scope does not include the required permission, IP not in allowlist |
429 Too Many Requests | Rate limit exceeded | More than 120 requests per minute from the same token |
Security best practices
Use the principle of least privilege
Use the principle of least privilege
Assign only the scopes your integration actually needs. A webhook consumer that only reads submission status should not have
templates:write.Rotate tokens regularly
Rotate tokens regularly
Set an
expires_at date when creating tokens. Create a new token before the old one expires, update your integration, then revoke the old token.Enable IP allowlisting
Enable IP allowlisting
Lock your production tokens to your server’s IP range. This prevents stolen tokens from being used outside your infrastructure.
Never expose tokens client-side
Never expose tokens client-side
API tokens must only be used in server-side code. For browser-based integrations, use JWT bearer tokens generated by your backend.
Monitor token usage
Monitor token usage
Review the
last_used_at timestamp on your tokens. Revoke any token that has not been used in a long time or that you do not recognize.Enable MFA on your account
Enable MFA on your account
If your account has MFA enforcement enabled, all users must verify a TOTP code at login. This protects against credential theft that could lead to token creation by an attacker.
API Versioning
All API responses include anX-API-Version: v1 header. The API is available at both /api/* and /api/v1/* (explicit version pin). Future breaking changes will be introduced under /api/v2.