Create an API key for an agent or CI
curl --request POST \
--url https://patch.gg/api/v1/tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scopes": [
"read"
],
"expires_in_days": 1825
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', scopes: ['read'], expires_in_days: 1825})
};
fetch('https://patch.gg/api/v1/tokens', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://patch.gg/api/v1/tokens"
payload = {
"name": "<string>",
"scopes": ["read"],
"expires_in_days": 1825
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"start": "<string>",
"scopes": [
"read"
],
"created_at": "<string>",
"expires_at": "<string>",
"last_used_at": "<string>",
"key": "<string>"
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}Account
Create an API key for an agent or CI
Only from a signed-in session, so one key can’t mint another.
POST
/
tokens
Create an API key for an agent or CI
curl --request POST \
--url https://patch.gg/api/v1/tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scopes": [
"read"
],
"expires_in_days": 1825
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', scopes: ['read'], expires_in_days: 1825})
};
fetch('https://patch.gg/api/v1/tokens', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://patch.gg/api/v1/tokens"
payload = {
"name": "<string>",
"scopes": ["read"],
"expires_in_days": 1825
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"start": "<string>",
"scopes": [
"read"
],
"created_at": "<string>",
"expires_at": "<string>",
"last_used_at": "<string>",
"key": "<string>"
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}{
"error": {
"code": "version_exists",
"message": "<string>",
"details": "<unknown>"
}
}Authorizations
An API key (pch_...) or the token from pch login.
Body
application/json
Response
The new key, shown once
The first characters, to tell keys apart
Available options:
read, publish, admin Shown once. Starts with pch_.