API Keys Endpoint
Manage API keys for your DreamSolve account.
Base URL: /api/v1/apiKeys
Authentication
All requests to this endpoint require a valid API key in the x-api-key header.
x-api-key: YOUR_API_KEY
List API Keys
Retrieve all API keys associated with your account.
Request
GET /api/v1/apiKeys
Headers
| Header | Required | Description |
|---|---|---|
x-api-key | Yes | Your API key |
Response
Status: 200 OK
{
"message": "[{\"id\":\"1\",\"user_id\":\"uuid\",\"api_key\":\"key123\",\"created_at\":\"2024-01-01T00:00:00Z\",\"updated_at\":\"2024-01-01T00:00:00Z\"}]"
}
The message field contains a JSON-encoded array of API key objects.
API Key Object
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the API key |
user_id | string | UUID of the user who owns the key |
api_key | string | The API key value |
created_at | string | ISO 8601 timestamp of creation |
updated_at | string | ISO 8601 timestamp of last update |
Example
curl -X GET \
-H "x-api-key: YOUR_API_KEY" \
https://dreamsolve.ai/api/v1/apiKeys
Create API Key
Create a new API key for your account.
Request
POST /api/v1/apiKeys
Headers
| Header | Required | Description |
|---|---|---|
x-api-key | Yes | Your existing API key |
Content-Type | Yes | application/json |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | The new API key value to create |
{
"apiKey": "your-new-api-key-value"
}
Response
Status: 201 Created
{
"message": "API key created successfully"
}
Errors
| Status | Message | Description |
|---|---|---|
| 400 | API key is required | Missing apiKey in request body |
| 401 | Invalid API key | Authentication failed |
| 500 | Error creating API key | Server error during creation |
Example
curl -X POST \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"apiKey": "my-new-api-key"}' \
https://dreamsolve.ai/api/v1/apiKeys
Update API Key
Update an existing API key.
Request
PUT /api/v1/apiKeys
Headers
| Header | Required | Description |
|---|---|---|
x-api-key | Yes | Your API key |
Content-Type | Yes | application/json |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The ID of the API key to update |
apiKey | string | Yes | The new API key value |
{
"id": "123",
"apiKey": "updated-api-key-value"
}
Response
Status: 200 OK
{
"message": "API key updated successfully"
}
Errors
| Status | Message | Description |
|---|---|---|
| 400 | ID and API key are required | Missing required fields |
| 401 | Invalid API key | Authentication failed |
| 500 | Error updating API key | Server error during update |
Example
curl -X PUT \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"id": "123", "apiKey": "my-updated-key"}' \
https://dreamsolve.ai/api/v1/apiKeys
Delete API Key
Delete an existing API key.
Request
DELETE /api/v1/apiKeys
Headers
| Header | Required | Description |
|---|---|---|
x-api-key | Yes | Your API key |
Content-Type | Yes | application/json |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The ID of the API key to delete |
{
"id": "123"
}
Response
Status: 200 OK
{
"message": "API key deleted successfully"
}
Errors
| Status | Message | Description |
|---|---|---|
| 400 | ID is required | Missing id in request body |
| 401 | Invalid API key | Authentication failed |
| 500 | Error deleting API key | Server error during deletion |
Example
curl -X DELETE \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"id": "123"}' \
https://dreamsolve.ai/api/v1/apiKeys
Security Notes
- API keys provide full access to your account's API key management
- Store your API keys securely and never expose them in client-side code
- If you suspect an API key has been compromised, delete it immediately and create a new one
- Each API key can only manage keys belonging to the same user account