API tokens
Create an API token
POST
Creates an organization API token and returns its secret value once.
cookiecookie
better-auth.session_token<token>Dashboard session cookie
application/json- body
name*stringLength
1 <= length <= 80scope?stringDefault
"write"Value in
"read""write"expiresAt?|Format
date-timeDefault
nullapplication/json- response
id*stringname*stringscope*ApiTokenScopeValue in
"read""write"start*stringcreatedBy*|nullexpiresAt*|Format
date-timelastUsedAt*|Format
date-timecreatedAt*stringFormat
date-timetoken*stringcurl -X POST 'https://api.example.com/api/v1/api-tokens' \
-H 'Content-Type: application/json' \
-d '{
"name": "string"
}'Example Response
{
"id": "string",
"name": "string",
"scope": "read",
"start": "string",
"createdBy": {
"id": "string",
"name": "string"
},
"expiresAt": "2019-08-24T14:15:22Z",
"lastUsedAt": "2019-08-24T14:15:22Z",
"createdAt": "2019-08-24T14:15:22Z",
"token": "string"
}