RepoAccessToken
Operations
Every route this entity exposes. Each route links to its own reference on this page.
| Method | Route | SDK operation | Returns |
|---|---|---|---|
POST |
/api/v1/organizations/{org_slug}/repos/{repo_slug}/access_tokens |
create |
Created repository access token |
GET |
/api/v1/organizations/{org_slug}/repos/{repo_slug}/access_tokens |
list |
Manual repository access tokens |
DELETE |
/api/v1/organizations/{org_slug}/repos/{repo_slug}/access_tokens/{id} |
remove |
Success |
Examples
One example per SDK, generated from the API model. The argument names are the parameters and fields of this entity, and the values are placeholders. The examples are not compiled or executed.
Golang
Construct client as shown in the Golang setup, then call the operations:
repo_access_tokens, err := client.RepoAccessToken(nil).List(map[string]any{"organization_id": "example", "repo_id": "example"}, nil)
if err != nil {
panic(err)
}
fmt.Println(repo_access_tokens)
created, err := client.RepoAccessToken(nil).Create(map[string]any{"organization_id": "example", "repo_id": "example", "name": "example"}, nil)
if err != nil {
panic(err)
}
fmt.Println(created)
removed, err := client.RepoAccessToken(nil).Remove(map[string]any{"id": "example_id", "organization_id": "example", "repo_id": "example"}, nil)
if err != nil {
panic(err)
}
fmt.Println(removed)
Lua
Construct client as shown in the Lua setup, then call the operations:
local repo_access_tokens, err = client:RepoAccessToken():list({ organization_id = "example", repo_id = "example" })
local created, err = client:RepoAccessToken():create({ organization_id = "example", repo_id = "example", name = "example" })
local removed, err = client:RepoAccessToken():remove({ id = "example_id", organization_id = "example", repo_id = "example" })
PHP
Construct client as shown in the PHP setup, then call the operations:
$repo_access_tokens = $client->RepoAccessToken()->list(["organization_id" => "example", "repo_id" => "example"]);
$created = $client->RepoAccessToken()->create(["organization_id" => "example", "repo_id" => "example", "name" => "example"]);
$client->RepoAccessToken()->remove(["id" => "example_id", "organization_id" => "example", "repo_id" => "example"]);
Python
Construct client as shown in the Python setup, then call the operations:
repo_access_tokens = client.RepoAccessToken().list({"organization_id": "example", "repo_id": "example"})
created = client.RepoAccessToken().create({ "organization_id": "example", "repo_id": "example", "name": "example" })
client.RepoAccessToken().remove({"id": "example_id", "organization_id": "example", "repo_id": "example"})
Ruby
Construct client as shown in the Ruby setup, then call the operations:
repo_access_tokens = client.RepoAccessToken.list({ "organization_id" => "example", "repo_id" => "example" })
created = client.RepoAccessToken.create({ "organization_id" => "example", "repo_id" => "example", "name" => "example" })
client.RepoAccessToken.remove({ "id" => "example_id", "organization_id" => "example", "repo_id" => "example" })
TypeScript
Construct client as shown in the TypeScript setup, then call the operations:
const repo_access_tokens = await client.RepoAccessToken().list({ organization_id: "example", repo_id: "example" })
const created = await client.RepoAccessToken().create({ organization_id: "example", repo_id: "example", name: "example" })
await client.RepoAccessToken().remove({ id: "example_id", organization_id: "example", repo_id: "example" })
Fields
| Field | Type | Required | Description |
|---|---|---|---|
access_token |
object |
Yes | Access Token |
active |
boolean |
Yes | Active |
created_at |
string |
Yes | Created At |
created_at_label |
one,string,null |
Yes | Created At Label |
credential_purpose |
string |
No | Issues a revocable read-write system credential valid for one hour. |
expires_at |
one,string,null |
Yes | Expires At |
expires_at_label |
one,string,null |
Yes | Expires At Label |
expires_in_days |
one,integer,null |
No | Expires In Days |
id |
string |
Yes | Id |
last_used_at |
one,string,null |
Yes | Last Used At |
last_used_at_label |
one,string,null |
Yes | Last Used At Label |
name |
string |
Yes | Name |
permission_level |
string |
No | Permission Level |
plain_text_token |
string |
Yes | Plain Text Token |
revoked_at |
one,string,null |
Yes | Revoked At |
revoked_at_label |
one,string,null |
Yes | Revoked At Label |
token_preview |
string |
Yes | Token Preview |
updated_at |
string |
Yes | Updated At |
updated_at_label |
one,string,null |
Yes | Updated At Label |
create
POST /api/v1/organizations/{org_slug}/repos/{repo_slug}/access_tokens
Operation ID: post_api_v1_organizations_org_slug_repos_repo_slug_access_tokens.
Authentication: bearer token (bearerAuth).
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
org_slug |
path |
string |
Yes | |
repo_slug |
path |
string |
Yes |
Request body
application/json
| Property | Type | Required | Description |
|---|---|---|---|
credential_purpose |
enum: git_remote_helper |
No | Issues a revocable read-write system credential valid for one hour. |
expires_in_days |
integer |
No | |
name |
string |
Yes | |
permission_level |
enum: read_only, read_write |
No |
Responses
200: Created repository access token
application/json
| Property | Type | Required | Description |
|---|---|---|---|
access_token |
object |
Yes | |
access_token.active |
boolean |
Yes | |
access_token.created_at |
string (date-time) |
Yes | |
access_token.created_at_label |
string |
Yes | |
access_token.expires_at |
string (date-time) |
Yes | |
access_token.expires_at_label |
string |
Yes | |
access_token.id |
string |
Yes | |
access_token.last_used_at |
string (date-time) |
Yes | |
access_token.last_used_at_label |
string |
Yes | |
access_token.name |
string |
Yes | |
access_token.permission_level |
enum: read_only, read_write |
Yes | |
access_token.revoked_at |
string (date-time) |
Yes | |
access_token.revoked_at_label |
string |
Yes | |
access_token.token_preview |
string |
Yes | |
access_token.updated_at |
string (date-time) |
Yes | |
access_token.updated_at_label |
string |
Yes | |
plain_text_token |
string |
Yes |
201: Created repository access token
application/json
| Property | Type | Required | Description |
|---|---|---|---|
access_token |
object |
Yes | |
access_token.active |
boolean |
Yes | |
access_token.created_at |
string (date-time) |
Yes | |
access_token.created_at_label |
string |
Yes | |
access_token.expires_at |
string (date-time) |
Yes | |
access_token.expires_at_label |
string |
Yes | |
access_token.id |
string |
Yes | |
access_token.last_used_at |
string (date-time) |
Yes | |
access_token.last_used_at_label |
string |
Yes | |
access_token.name |
string |
Yes | |
access_token.permission_level |
enum: read_only, read_write |
Yes | |
access_token.revoked_at |
string (date-time) |
Yes | |
access_token.revoked_at_label |
string |
Yes | |
access_token.token_preview |
string |
Yes | |
access_token.updated_at |
string (date-time) |
Yes | |
access_token.updated_at_label |
string |
Yes | |
plain_text_token |
string |
Yes |
401: Unauthorized
403: Forbidden
404: Not found
422: Unprocessable entity
502: Bad gateway
list
GET /api/v1/organizations/{org_slug}/repos/{repo_slug}/access_tokens
Operation ID: api_v1_repository_access_tokens.
Authentication: bearer token (bearerAuth).
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
org_slug |
path |
string |
Yes | |
repo_slug |
path |
string |
Yes |
Responses
200: Manual repository access tokens
application/json
| Property | Type | Required | Description |
|---|---|---|---|
access_tokens |
array of object |
Yes | |
access_tokens[].active |
boolean |
Yes | |
access_tokens[].created_at |
string (date-time) |
Yes | |
access_tokens[].created_at_label |
string |
Yes | |
access_tokens[].expires_at |
string (date-time) |
Yes | |
access_tokens[].expires_at_label |
string |
Yes | |
access_tokens[].id |
string |
Yes | |
access_tokens[].last_used_at |
string (date-time) |
Yes | |
access_tokens[].last_used_at_label |
string |
Yes | |
access_tokens[].name |
string |
Yes | |
access_tokens[].permission_level |
enum: read_only, read_write |
Yes | |
access_tokens[].revoked_at |
string (date-time) |
Yes | |
access_tokens[].revoked_at_label |
string |
Yes | |
access_tokens[].token_preview |
string |
Yes | |
access_tokens[].updated_at |
string (date-time) |
Yes | |
access_tokens[].updated_at_label |
string |
Yes |
401: Unauthorized
403: Forbidden
404: Not found
422: Unprocessable entity
502: Bad gateway
remove
DELETE /api/v1/organizations/{org_slug}/repos/{repo_slug}/access_tokens/{id}
Operation ID: api_v1_repository_access_token.
Authentication: bearer token (bearerAuth).
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
org_slug |
path |
string |
Yes | |
repo_slug |
path |
string |
Yes | |
id |
path |
string |
Yes |
Responses
200: Success
application/json
The response is object.