Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Authentication

The Driftwood API supports two authentication methods: user tokens (for interactive sessions) and OAuth app credentials (for integrations and automated access).

All authenticated requests must include an Authorization header:

Authorization: Bearer YOUR_ACCESS_TOKEN

Use email/password login to get access and refresh tokens. Best for user-facing applications.

Terminal window
curl -X POST https://api.driftwoodapp.com/api/auth-register \
-H "Content-Type: application/json" \
-d '{
"email": "you@example.com",
"password": "your-secure-password",
"name": "Your Name"
}'

Response:

{
"ok": true,
"result": {
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"refresh_token": "dGhpcyBpcyBhIHJlZnJl...",
"expires_in": 900,
"user": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"email": "you@example.com",
"name": "Your Name",
"role": "owner"
}
}
}
Terminal window
curl -X POST https://api.driftwoodapp.com/api/auth-login \
-H "Content-Type: application/json" \
-d '{
"email": "you@example.com",
"password": "your-password"
}'

Response: Same format as register.

Access tokens are short-lived. Use the refresh token to get a new pair:

Terminal window
curl -X POST https://api.driftwoodapp.com/api/auth-refresh-token \
-H "Content-Type: application/json" \
-d '{"refresh_token": "dGhpcyBpcyBhIHJlZnJl..."}'

Response:

{
"ok": true,
"result": {
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"refresh_token": "bmV3IHJlZnJlc2ggdG9r...",
"expires_in": 900
}
}
Terminal window
curl -X POST https://api.driftwoodapp.com/api/auth-logout \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Use OAuth apps for server-to-server integrations. OAuth apps use the client credentials grant type to obtain access tokens.

Create an app from the Driftwood UI or via the API:

Terminal window
curl -X POST https://api.driftwoodapp.com/api/oauth-apps-create \
-H "Authorization: Bearer YOUR_USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "My Integration"}'

Response:

{
"ok": true,
"result": {
"app": {
"id": "app-uuid-here",
"name": "My Integration",
"client_id": "dw_ci_abc123def456",
"client_secret_prefix": "dw_cs_"
},
"client_secret": "dw_cs_full_secret_value_here"
}
}
Terminal window
curl -X POST https://api.driftwoodapp.com/api/oauth-token \
-H "Content-Type: application/json" \
-d '{
"grant_type": "client_credentials",
"client_id": "dw_ci_abc123def456",
"client_secret": "dw_cs_full_secret_value_here"
}'

Response:

{
"ok": true,
"result": {
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"token_type": "bearer",
"expires_in": 3600
}
}
Terminal window
curl -X POST https://api.driftwoodapp.com/api/contacts-list \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
-H "Content-Type: application/json" \
-d '{"limit": 10}'

OAuth app tokens have the same access as the user who created the app, scoped to their account.

OperationEndpointDescription
Createoauth-apps-createCreate a new OAuth app
Listoauth-apps-listList all OAuth apps
Revokeoauth-apps-revokePermanently revoke an app

List apps:

Terminal window
curl -X POST https://api.driftwoodapp.com/api/oauth-apps-list \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"include_revoked": false}'
Token TypeLifetime
User access token15 minutes
User refresh token30 days
OAuth access token1 hour

Access tokens are JWTs containing:

ClaimDescription
user_idThe authenticated user’s UUID
account_idThe account UUID (user tokens only)
token_type"user", "admin", or "oauth_client"
expToken expiration timestamp