Skip to main content
POST
https://api.relace.run
/
v1
/
repo_token
curl -X POST https://api.relace.run/v1/repo_token \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "my-token",
    "repo_ids": [
      "123e4567-e89b-12d3-a456-426614174000",
      "987fcdeb-51a2-43f7-b123-456789abcdef"
    ],
    "ttl_seconds": 3600
  }'
{
  "name": "my-token",
  "token": "rlcr-a1b2c3d4e5f67890abcdef1234567890abcdef12",
  "repo_ids": [
    "123e4567-e89b-12d3-a456-426614174000",
    "987fcdeb-51a2-43f7-b123-456789abcdef"
  ],
  "expires_at": "2025-12-01T12:00:00Z"
}
Repo tokens provide scoped read/write access to specific repositories. They can be used in place of your Relace API key for repo-specific operations.
Repo tokens are strongly recommended for use in sandboxed environments to prevent unintended access to other resources associated with your Relace account.

Request Body

name
string
required
A descriptive name for the token
repo_ids
array
required
Array of repository UUIDs that this token will have read/write access to
ttl_seconds
integer
Optional time-to-live in seconds for the token. If set, the token will expire after this duration.

Response

token
string
The generated repo token value.
Tokens can only be referenced by this value; make sure to store it for future use.
name
string
The name of the repo token
repo_ids
array
Array of repository UUIDs this token has read/write access to
expires_at
string
The ISO 8601 timestamp when this token will expire, if a TTL was set
curl -X POST https://api.relace.run/v1/repo_token \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "my-token",
    "repo_ids": [
      "123e4567-e89b-12d3-a456-426614174000",
      "987fcdeb-51a2-43f7-b123-456789abcdef"
    ],
    "ttl_seconds": 3600
  }'
{
  "name": "my-token",
  "token": "rlcr-a1b2c3d4e5f67890abcdef1234567890abcdef12",
  "repo_ids": [
    "123e4567-e89b-12d3-a456-426614174000",
    "987fcdeb-51a2-43f7-b123-456789abcdef"
  ],
  "expires_at": "2025-12-01T12:00:00Z"
}

Using Repo Tokens

Once created, repo tokens can be used as bearer tokens for authentication on any /repo/{repo_id} endpoint that they are scoped for:
Example Usage
# Use the repo token to search within an authorized repo
curl -X POST https://api.relace.run/v1/repo/123e4567-e89b-12d3-a456-426614174000/search \
  -H "Authorization: Bearer rlcr-a1b2c3d4e5f67890abcdef1234567890abcdef12" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "authentication logic"
  }'