API Keys API
API keys are used to authenticate requests to the Repurai API. You can manage your keys programmatically using the following actions or via the Dashboard.
The API key model
The API key model represents a secure credential for accessing your Repurai account data through the API.
Properties
- Name
id- Type
- string
- Description
Unique identifier for the API key.
- Name
name- Type
- string
- Description
A descriptive name for the API key to help you identify its purpose.
- Name
keyPrefix- Type
- string
- Description
The first few characters of the raw key (e.g.,
rep_abcd).
- Name
keySuffix- Type
- string
- Description
The last few characters of the raw key.
- Name
lastUsedAt- Type
- timestamp
- Description
The last time this API key was used to authenticate a request.
- Name
createdAt- Type
- timestamp
- Description
When the API key was generated.
Create an API key
Create a new API key for your account. This is the only time the full raw key will be returned in the response. Store it securely as it cannot be retrieved later.
Required attributes
- Name
name- Type
- string
- Description
A name to identify the key (e.g., "Production Server").
Request
curl -X POST https://api.repur.ai/v1/api-keys \
-H "X-API-Key: {your_existing_api_key}" \
-H "Content-Type: application/json" \
-d '{
"name": "My New Key"
}'
{
"success": true,
"data": {
"id": "key_123",
"name": "My New Key",
"rawKey": "rep_728b93..."
}
}
List all API keys
Retrieve a list of all API keys associated with your account. Note that this endpoint only returns key metadata and masked versions of the keys (prefix/suffix).
Request
curl https://api.repur.ai/v1/api-keys \
-H "X-API-Key: {your_api_key}"
{
"success": true,
"data": [
{
"id": "key_123",
"name": "Production Server",
"keyPrefix": "rep_728b",
"keySuffix": "a92b10",
"lastUsedAt": "2024-03-14T10:30:00Z"
}
]
}
Revoke an API key
Permanently delete an API key. Any future requests using this key will be rejected.
Request
curl -X DELETE https://api.repur.ai/v1/api-keys/key_123 \
-H "X-API-Key: {your_api_key}"
{
"success": true
}
Rename an API key
Update the label for an existing API key to better reflect its usage.
Required attributes
- Name
name- Type
- string
- Description
The new descriptive name for the key.
Request
curl -X PATCH https://api.repur.ai/v1/api-keys/key_123 \
-H "X-API-Key: {your_api_key}" \
-H "Content-Type: application/json" \
-d '{"name": "Staging Server"}'