API Keys
Update API Key
Update the label or expiry of an API key.
PATCH
/
v1
/
tokens
/
{id}
curl -X PATCH https://api.byteport.com/v1/tokens/9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34 \
-H "Authorization: Bearer $BYTEPORT_API_KEY" \
-H "User-Agent: my-app/1.0" \
-H "Content-Type: application/json" \
-d '{
"name": "production-pipeline-v2",
"expires_at": "2027-01-31T23:59:59Z"
}'
const id = "9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34";
await fetch(`https://api.byteport.com/v1/tokens/${id}`, {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.BYTEPORT_API_KEY}`,
"User-Agent": "my-app/1.0",
"Content-Type": "application/json",
},
body: JSON.stringify({ name: "production-pipeline-v2" }), // either field alone is fine
});
import os, requests
key_id = "9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34"
requests.patch(
f"https://api.byteport.com/v1/tokens/{key_id}",
headers={
"Authorization": f"Bearer {os.environ['BYTEPORT_API_KEY']}",
"User-Agent": "my-app/1.0",
},
json={"expires_at": "2027-01-31T23:59:59Z"}, # either field alone is fine
)
(empty body)
{
"error": 400,
"message": "at least one of name or expires_at is required"
}
Update an existing key’s
name or expires_at. Send only the fields you want
to change — you must include at least one of them, or the request is
rejected with 400. The key’s secret is never changed and is never returned, so
editing a label or expiry doesn’t interrupt anything authenticating with the
key. A successful update returns 204 No Content.
curl -X PATCH https://api.byteport.com/v1/tokens/9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34 \
-H "Authorization: Bearer $BYTEPORT_API_KEY" \
-H "User-Agent: my-app/1.0" \
-H "Content-Type: application/json" \
-d '{
"name": "production-pipeline-v2",
"expires_at": "2027-01-31T23:59:59Z"
}'
const id = "9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34";
await fetch(`https://api.byteport.com/v1/tokens/${id}`, {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.BYTEPORT_API_KEY}`,
"User-Agent": "my-app/1.0",
"Content-Type": "application/json",
},
body: JSON.stringify({ name: "production-pipeline-v2" }), // either field alone is fine
});
import os, requests
key_id = "9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34"
requests.patch(
f"https://api.byteport.com/v1/tokens/{key_id}",
headers={
"Authorization": f"Bearer {os.environ['BYTEPORT_API_KEY']}",
"User-Agent": "my-app/1.0",
},
json={"expires_at": "2027-01-31T23:59:59Z"}, # either field alone is fine
)
(empty body)
{
"error": 400,
"message": "at least one of name or expires_at is required"
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Identifier of the API key to update (a UUID).
Body
application/json
Provide at least one of name or expires_at.
New label for the key. If supplied it must be non-empty (400 otherwise). Omit to leave the current label unchanged.
Example:
"production-pipeline-v2"
New expiry timestamp (RFC 3339). Use this to extend, shorten, or set an expiry on a previously non-expiring key. Omit to leave the current expiry unchanged.
Example:
"2027-01-31T23:59:59Z"
Response
API key updated. The response body is empty.
curl -X PATCH https://api.byteport.com/v1/tokens/9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34 \
-H "Authorization: Bearer $BYTEPORT_API_KEY" \
-H "User-Agent: my-app/1.0" \
-H "Content-Type: application/json" \
-d '{
"name": "production-pipeline-v2",
"expires_at": "2027-01-31T23:59:59Z"
}'
const id = "9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34";
await fetch(`https://api.byteport.com/v1/tokens/${id}`, {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.BYTEPORT_API_KEY}`,
"User-Agent": "my-app/1.0",
"Content-Type": "application/json",
},
body: JSON.stringify({ name: "production-pipeline-v2" }), // either field alone is fine
});
import os, requests
key_id = "9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34"
requests.patch(
f"https://api.byteport.com/v1/tokens/{key_id}",
headers={
"Authorization": f"Bearer {os.environ['BYTEPORT_API_KEY']}",
"User-Agent": "my-app/1.0",
},
json={"expires_at": "2027-01-31T23:59:59Z"}, # either field alone is fine
)
(empty body)
{
"error": 400,
"message": "at least one of name or expires_at is required"
}

