Create an API token
const url = 'https://example.com/api/v1/me/tokens';const options = { method: 'POST', headers: { cookie: '__Host-shardkeep_session=<__Host-shardkeep_session>', 'Content-Type': 'application/json' }, body: '{"name":"example","permissions":["servers.read"],"expiresAt":"2026-04-15T12:00:00Z"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/me/tokens \ --header 'Content-Type: application/json' \ --cookie __Host-shardkeep_session=<__Host-shardkeep_session> \ --data '{ "name": "example", "permissions": [ "servers.read" ], "expiresAt": "2026-04-15T12:00:00Z" }'Needs a session: an API token cannot create other tokens. The secret is returned once and never again.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Restrict the token to these permissions. Omit for all of yours.
When the token stops working. Omit for no expiry.
Responses
Section titled “Responses”Token created.
object
object
The start of the secret, to tell tokens apart.
The token’s permission subset; absent means all of your permissions.
The token itself, skp_…. Shown only once.
Example
{ "token": { "permissions": [ "servers.read" ] }}The request is invalid.
An RFC 9457 problem with a machine-readable code.
object
Stable machine-readable error code.
Example
{ "type": "about:blank", "title": "Conflict", "status": 409, "code": "conflict"}Not signed in, or the credentials are invalid.
An RFC 9457 problem with a machine-readable code.
object
Stable machine-readable error code.
Example
{ "type": "about:blank", "title": "Conflict", "status": 409, "code": "conflict"}Signed in, but not allowed.
An RFC 9457 problem with a machine-readable code.
object
Stable machine-readable error code.
Example
{ "type": "about:blank", "title": "Conflict", "status": 409, "code": "conflict"}Clashes with existing data or state.
An RFC 9457 problem with a machine-readable code.
object
Stable machine-readable error code.
Example
{ "type": "about:blank", "title": "Conflict", "status": 409, "code": "conflict"}Shardkeep is free software under the AGPL-3.0. Minecraft is a trademark of Mojang AB; Shardkeep is not affiliated with or endorsed by Mojang or Microsoft.