Issue a personal access token for the authenticated subject.
Inherits all restrictions of the authenticating PAT, if any.
The token cannot outlive that PAT. JWT tokens expire within seven days;
named PV1 tokens expire within 365 days and appear in the user's token list.
Request
POST
https://api.sourcecraft.tech/user/pats
Body
application/json
{
"expires_at": "2025-01-01T00:00:00Z",
"type": "jwt",
"name": "example",
"scope": {
"role": "viewer",
"repo_ids": [
"example"
]
}
}
|
Name |
Description |
|
expires_at |
Type: string<date-time> Required. Must be in the future, at most seven days (JWT) or 365 days (PV1) Example: |
|
name |
Type: string Required for PV1. The display name in the user's token list. Example: |
|
scope |
Type: CreatePATRequest.Scope Example
|
|
type |
Type: TokenType Enum: |
TokenType
Type: string
Enum: jwt, pv1
RepoRole
Type: string
Enum: viewer, contributor, developer, maintainer, admin
CreatePATRequest.Scope
|
Name |
Description |
|
repo_ids |
Type: string[] Public UUIDs of repositories to which the PAT is restricted (at most 100). Example
|
|
role |
Type: RepoRole Enum: |
Example
{
"role": "viewer",
"repo_ids": [
"example"
]
}
Responses
201 Created
A successful response.
Body
application/json
{
"token": "example",
"expires_at": "2025-01-01T00:00:00Z",
"type": "jwt"
}
|
Name |
Description |
|
expires_at |
Type: string<date-time> Example: |
|
token |
Type: string Credential. Returned only on creation. Example: |
|
type |
Type: TokenType Enum: |
default
Both Client Errors (4xx) and Server Errors (5xx) are serialized into this scheme
Body
application/json
{
"error_code": "example",
"message": "example",
"request_id": "example",
"details": null
}
|
Name |
Description |
|
details |
Type: unknown Example: |
|
error_code |
Type: string Example: |
|
message |
Type: string Example: |
|
request_id |
Type: string Example: |