Quickstart
Authentication and a sandbox request.
Request the product catalogue and a sandbox quote using curl and Python 3.
Before you start
Ask your onboarding contact for an activated sandbox key, its expiry, approved outbound IPs, and product permissions. You need curl and Python 3 on a trusted backend machine.
| Environment | Base URL | Credentials |
|---|---|---|
| Sandbox | https://api.elkcrypto.com/sandbox | Activated sandbox key |
| Production | https://api.elkcrypto.com | Separate key after approval |
Append /v1/... to the base URL. The sandbox progress URL intentionally contains both prefixes: /sandbox/v1/sandbox/progress.
1. Store your key privately
Run the following blocks in the same shell. Enter your key at the prompt; the script saves it in a private header file.
mkdir -m 700 elk-sandbox
cd elk-sandbox
umask 077
python3 - <<'PY'
import getpass, os
key = getpass.getpass('Sandbox API key: ')
if not key or any(c.isspace() for c in key):
raise SystemExit('Invalid key input')
fd = os.open('auth.headers', os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
with os.fdopen(fd, 'w') as output:
output.write('Authorization: Bearer ' + key + '\n')
PY
BASE_URL=https://api.elkcrypto.com/sandboxExclude auth.headers from version control.
2. Discover eligible products
curl --connect-timeout 5 --max-time 10 \
--header @auth.headers --dump-header catalogue.headers \
--output catalogue.json --write-out 'HTTP %{http_code}\n' \
"$BASE_URL/v1/catalogue?limit=50"A successful response is HTTP 200 with records and next_after_id. Pass next_after_id as after_id for subsequent pages until the response cursor is null.
3. Request a quote
The sandbox supports USDT/USD in OTC-SPOT. A buy acquires USDT and pays USD. All quantities are decimal strings, not JSON numbers.
python3 - <<'PY'
import json, uuid
operation = {
'idempotency_key': str(uuid.uuid4()),
'path': '/v1/get_quote',
'body': {'symbol': 'USDT/USD', 'market': 'OTC-SPOT',
'side': 'buy', 'quantity': '1000'},
}
with open('quote-operation.json', 'x') as output:
json.dump(operation, output)
with open('quote-request.json', 'x') as output:
json.dump(operation['body'], output)
PY
QUOTE_ID=$(python3 -c 'import json; print(json.load(open("quote-operation.json"))["idempotency_key"])')
curl --connect-timeout 5 --max-time 10 \
--header @auth.headers --header 'Content-Type: application/json' \
--header "Idempotency-Key: $QUOTE_ID" \
--data-binary @quote-request.json \
--dump-header quote.headers --output quote.json \
--write-out 'HTTP %{http_code}\n' "$BASE_URL/v1/get_quote"A successful response is HTTP 200 with quote_id, price, pay, receive, and expires_at. The fixed sandbox buy price is 1.001: quantity 1000 pays 1001 USD and receives 1000 USDT.
The script saves the request and UUID in quote-operation.json. To retry, reuse that UUID and request body. Sandbox quotes expire after at most 30 seconds; use the response expires_at value.
Next steps
- Integration guide: request IDs, retries, and amounts.
- Sandbox certification: acceptance and test scenarios.
- API reference and OpenAPI specification.