Skip to main content

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

HeaderRequiredDescription
x-api-keyYesYour 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

FieldTypeDescription
idstringUnique identifier for the API key
user_idstringUUID of the user who owns the key
api_keystringThe API key value
created_atstringISO 8601 timestamp of creation
updated_atstringISO 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

HeaderRequiredDescription
x-api-keyYesYour existing API key
Content-TypeYesapplication/json

Request Body

FieldTypeRequiredDescription
apiKeystringYesThe new API key value to create
{
"apiKey": "your-new-api-key-value"
}

Response

Status: 201 Created

{
"message": "API key created successfully"
}

Errors

StatusMessageDescription
400API key is requiredMissing apiKey in request body
401Invalid API keyAuthentication failed
500Error creating API keyServer 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

HeaderRequiredDescription
x-api-keyYesYour API key
Content-TypeYesapplication/json

Request Body

FieldTypeRequiredDescription
idstringYesThe ID of the API key to update
apiKeystringYesThe new API key value
{
"id": "123",
"apiKey": "updated-api-key-value"
}

Response

Status: 200 OK

{
"message": "API key updated successfully"
}

Errors

StatusMessageDescription
400ID and API key are requiredMissing required fields
401Invalid API keyAuthentication failed
500Error updating API keyServer 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

HeaderRequiredDescription
x-api-keyYesYour API key
Content-TypeYesapplication/json

Request Body

FieldTypeRequiredDescription
idstringYesThe ID of the API key to delete
{
"id": "123"
}

Response

Status: 200 OK

{
"message": "API key deleted successfully"
}

Errors

StatusMessageDescription
400ID is requiredMissing id in request body
401Invalid API keyAuthentication failed
500Error deleting API keyServer 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