Create access token
POST https://datafa.st/api/v1/admin/access-tokensCreate a new
dft_ account token with specific permissions and optional website scope. The full token is returned once in the response — store it securely.You cannot grant permissions beyond what your own token has. Maximum 20 tokens per account.
Request
Body parameters
namestring
Label in the dashboard. Example:
"Production agent". Omit to store as null.permissionsstring[]
JSON array of permission strings controlling what the new token can do. Omit for full access (
["*"]). Must not exceed your caller token — see permission list. Examples: read-only ["analytics:read", "websites:read"]; funnel manager ["funnels:read", "funnels:write", "websites:read"]; full access ["*"].websiteIdsstring[]
Websites this token may access. Pass
[] (default) for all websites on your account, or ObjectId strings to restrict. Get IDs from List websites. Example: ["665f0b3c4d2e1a0012345678"]. Cannot exceed your caller token scope.Example request body
{
"name": "Analytics read-only agent",
"permissions": ["analytics:read", "websites:read"],
"websiteIds": ["665f0b3c4d2e1a0012345678"]
}
What to pass in permissions
| If you want… | Pass this array |
|---|---|
| Read analytics and visitors | ["analytics:read", "websites:read"] |
| Send server-side goals | add "goals:write" |
| Record payments | add "payments:write" |
| Manage funnels | ["funnels:read", "funnels:write", "websites:read"] |
| Manage alerts | ["alerts:read", "alerts:write", "websites:read"] |
| Create other tokens / keys | add "api-keys:read" / "api-keys:write" |
| Everything | ["*"] or omit the field |
Valid strings:
analytics:read, goals:read, goals:write, payments:read, payments:write, identify:write, websites:read, websites:write, settings:read, settings:write, funnels:read, funnels:write, alerts:read, alerts:write, team:read, team:write, api-keys:read, api-keys:write, or "*".Full reference: authentication and scopes.
Response
Returns a JSON object with
status: "success" and endpoint-specific fields in data.Response fields
data[].idstring
Token ObjectId.
data[].userIdstring
User ObjectId that owns the token.
data[].namestring|null
Human-readable name for the resource or event. The exact meaning depends on the endpoint.
data[].displayKeystring
Masked token shown in the dashboard.
data[].scopestring
Token scope. Account tokens use
user.data[].websiteIdstring|null
Website ObjectId used by account tokens to choose which website to query or manage. Website ObjectId for legacy website-scoped tokens. Account tokens return
null.data[].permissionsstring[]
Granted permission strings.
['*'] means full access. See permission list. Example: ['analytics:read', 'websites:read'].data[].websiteIdsstring[]
Websites this token can access. Empty array
[] means all websites on the account. Example: ['665f0b3c4d2e1a0012345678'].data[].keyPrefixstring
Indexed token prefix used for lookup.
data[].lastUsedAtstring|null
Last usage timestamp.
data[].usageCountnumber
Number of authenticated uses.
data[].createdAtstring
Creation timestamp.
data[].updatedAtstring
Last update timestamp.
data[].keystring
Only returned when creating a token. Full raw token shown once.
Authentication
Requires a
dft_ account token with api-keys:write. Website API keys (df_) cannot call this endpoint because it manages account-level resources.Create tokens in Account settings → API.
Errors
400 — Invalid permissions or token limit reached (max 20).
403 — Requested scope exceeds caller token permissions.
See API errors for the standard error envelope, auth failures, validation errors, permission errors, and rate limits.