Overview
POST
/tokenstokensMint a token principal (raw `adh_…` secret shown once)
Create a record in tokens.
Auth: bearerAuth — calls run as the authenticated user.
Parameters
- workspacequery · optionalstring
Scope every op to this WORKSPACE’s owning principal (the caller’s own customer slug, or an organization the caller belongs to). Omitted: the caller’s own tokens. Unknown/foreign slug: 404.
Request body
application/json · optional
- namestring
- descriptionoptionalstring
- expiresAtoptionalstring?
- ecosystemIdoptionalstring
The ecosystem (rdid or uuid; must be manageable by the caller) the token — and its isolated bucket — binds to. Omitted: the owner’s own ecosystem.
Example
{
"name": "string",
"description": "string",
"expiresAt": "2020-01-01T00:00:00.000Z",
"ecosystemId": "string"
}Responses
201
Token principal + raw secret (shown once)
- idstring
- rdidstring
reverse-domain id, e.g. token.<owner-slug>.<name>
- slugstring
- descriptionstring
- prefixstring
Non-secret leading chars of the secret, for display
- bucketRdidstring
the token’s own isolated bucket, e.g. storage.<owner-slug>.<name>
- tokenstring
the raw `adh_…` secret — shown once, never again
Example
{
"id": "string",
"rdid": "string",
"slug": "string",
"description": "string",
"prefix": "string",
"bucketRdid": "string",
"token": "string"
}400
Error
- erroroptionalobject
Example
{
"error": {
"message": "string",
"code": "string"
}
}401
Error
- erroroptionalobject
Example
{
"error": {
"message": "string",
"code": "string"
}
}403
Error
- erroroptionalobject
Example
{
"error": {
"message": "string",
"code": "string"
}
}404
Error
- erroroptionalobject
Example
{
"error": {
"message": "string",
"code": "string"
}
}409
Error
- erroroptionalobject
Example
{
"error": {
"message": "string",
"code": "string"
}
}Code examples
cURL
curl -X POST "https://api.agenticdeveloperhub.com/tokens" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "string",
"description": "string",
"expiresAt": "2020-01-01T00:00:00.000Z",
"ecosystemId": "string"
}'JavaScript
const res = await fetch("https://api.agenticdeveloperhub.com/tokens", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: "{\n \"name\": \"string\",\n \"description\": \"string\",\n \"expiresAt\": \"2020-01-01T00:00:00.000Z\",\n \"ecosystemId\": \"string\"\n}",
});
const data = await res.json();