Create Credential
Create a new trading account credential.
Endpoint
POST /api/v3/credential/create
Description
Creates new API credentials for a trading account. This allows you to store exchange API keys securely for automated trading.
Authentication
Requires Bearer token authentication.
Authorization: Bearer {access_token}
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
venue | string | Yes | Exchange venue (e.g., BINANCE) |
apiKey | string | Yes | Exchange API key |
apiSecret | string | Yes | Exchange API secret |
apiPassphrase | string | No | API passphrase (required for some exchanges) |
name | string | No | Custom name for the credential |
type | string | No | Credential type (default: EXCHANGE) |
Response
Returns the created credential object. Note: The API secret is not returned for security.
| Field | Type | Description |
|---|---|---|
credentialId | string | Unique credential identifier |
userId | string | User ID |
venue | string | Exchange venue |
name | string | Credential name |
type | string | Credential type |
apiKey | string | API key (masked) |
status | string | Credential status (ACTIVE) |
createdAt | integer | Creation timestamp (milliseconds) |
Usage
import requests
headers = {"Authorization": f"Bearer {access_token}"}
response = requests.post(
"https://cadenza-api-uat.algo724.com/api/v3/credential/create",
headers=headers,
json={
"venue": "BINANCE",
"apiKey": "your-api-key",
"apiSecret": "your-api-secret",
"name": "My Binance API Key"
}
)
credential = response.json()["data"]
print(f"Credential ID: {credential['credentialId']}")
curl -X POST https://cadenza-api-uat.algo724.com/api/v3/credential/create \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
-H "Content-Type: application/json" \
-d '{
"venue": "BINANCE",
"apiKey": "your-api-key",
"apiSecret": "your-api-secret",
"name": "My API Key"
}'
Example Response
{
"data": {
"credentialId": "660e8400-e29b-41d4-a716-446655440000",
"userId": "user-uuid-here",
"venue": "BINANCE",
"name": "My Binance API Key",
"type": "EXCHANGE",
"apiKey": "your-api-***",
"status": "ACTIVE",
"createdAt": 1703052635110,
"updatedAt": 1703052635110
},
"success": true,
"errno": 0,
"error": null
}
Error Responses
| HTTP Code | Error | Description |
|---|---|---|
| 400 | Invalid request | Missing or invalid parameters |
| 400 | Invalid credentials | API credentials failed validation |
| 401 | Unauthorized | Invalid or expired access token |
Notes
- API secrets are encrypted and stored securely
- API secrets are never returned in API responses
- Credentials are validated against the exchange before being stored
- Use
credential.revoketo invalidate credentials