# Create Token

`POST /v1/tokens`

Create a personal access token for driving this API without the dashboard.

The token authenticates as its creator and acts with that user's live role,
so it can never do more than they can. It does not expire; deleting it is
the revocation. The plaintext value is returned once here and never again —
treat it like a password and do not echo it back into a conversation.

Authenticate with `Authorization: Bearer $TALQING_API_KEY`. Errors use the shared envelope: https://docs.talqing.com/api-reference/errors.md

## OpenAPI

```json
{
 "openapi":"3.1.0",
 "servers":[
  {
   "description":"Talqing API",
   "url":"https://api.talqing.com"
  }
 ],
 "paths":{
  "/v1/tokens":{
   "post":{
    "description":"Create a personal access token for driving this API without the dashboard.\n\nThe token authenticates as its creator and acts with that user's live role,\nso it can never do more than they can. It does not expire; deleting it is\nthe revocation. The plaintext value is returned once here and never again \u2014\ntreat it like a password and do not echo it back into a conversation.",
    "operationId":"tokens.create",
    "requestBody":{
     "content":{
      "application/json":{
       "schema":{
        "$ref":"#/components/schemas/CreateTokenRequest"
       }
      }
     },
     "required":true
    },
    "responses":{
     "201":{
      "content":{
       "application/json":{
        "schema":{
         "$ref":"#/components/schemas/TokenCreatedResponse"
        }
       }
      },
      "description":"Successful Response"
     },
     "400":{
      "$ref":"#/components/responses/BadRequest"
     },
     "401":{
      "$ref":"#/components/responses/Unauthorized"
     },
     "409":{
      "$ref":"#/components/responses/Conflict"
     },
     "422":{
      "$ref":"#/components/responses/ValidationFailed"
     },
     "default":{
      "$ref":"#/components/responses/Error"
     }
    },
    "security":[
     {
      "BearerAuth":[]
     },
     {
      "SessionCookie":[]
     }
    ],
    "summary":"Create Token",
    "tags":[
     "tokens"
    ]
   }
  }
 },
 "components":{
  "responses":{
   "BadRequest":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"Well-formed, but rejected by a rule; `detail.errors` lists each problem."
   },
   "Conflict":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"The resource's current state forbids this \u2014 a name already taken, a job already running."
   },
   "Error":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"Unexpected error. Every error this API returns carries this body."
   },
   "Unauthorized":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"Missing credential, or one that is revoked or no longer a member of this organization."
   },
   "ValidationFailed":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"The request did not match this operation's schema; `detail.errors` lists each field."
   }
  },
  "schemas":{
   "CreateTokenRequest":{
    "properties":{
     "name":{
      "maxLength":100,
      "minLength":1,
      "title":"Name",
      "type":"string"
     }
    },
    "required":[
     "name"
    ],
    "title":"CreateTokenRequest",
    "type":"object"
   },
   "ErrorBody":{
    "description":"The structured half of our error contract: a human `message` plus a list\nof individual `errors` (used wherever we surface many problems at once,\nincluding tool publish, op-tree checks, and request validation). The global\nexception handlers normalize every API error to\n`{detail: {message, errors, code}}`, so SDKs can parse one shape consistently.",
    "properties":{
     "code":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "default":null,
      "description":"A stable identifier for this error, when it has one.",
      "title":"Code"
     },
     "errors":{
      "items":{
       "type":"string"
      },
      "title":"Errors",
      "type":"array"
     },
     "message":{
      "title":"Message",
      "type":"string"
     }
    },
    "required":[
     "message",
     "errors"
    ],
    "title":"ErrorBody",
    "type":"object"
   },
   "ErrorResponse":{
    "description":"The body of every error response, at every status code.",
    "properties":{
     "detail":{
      "$ref":"#/components/schemas/ErrorBody"
     }
    },
    "required":[
     "detail"
    ],
    "title":"ErrorResponse",
    "type":"object"
   },
   "TokenCreatedResponse":{
    "properties":{
     "created_at":{
      "format":"date-time",
      "title":"Created At",
      "type":"string"
     },
     "id":{
      "format":"uuid",
      "title":"Id",
      "type":"string"
     },
     "kind":{
      "enum":[
       "manual",
       "mcp"
      ],
      "title":"Kind",
      "type":"string"
     },
     "name":{
      "title":"Name",
      "type":"string"
     },
     "token":{
      "title":"Token",
      "type":"string"
     },
     "user_email":{
      "title":"User Email",
      "type":"string"
     },
     "user_id":{
      "format":"uuid",
      "title":"User Id",
      "type":"string"
     }
    },
    "required":[
     "id",
     "name",
     "kind",
     "user_id",
     "user_email",
     "created_at",
     "token"
    ],
    "title":"TokenCreatedResponse",
    "type":"object"
   }
  }
 }
}
```
