Authentication

API Key

YCloud APIs use API keys for authentication. An API key is a token that a client provides when making API calls. The key should be sent as a request header named X-API-Key:

GET /v2/balance HTTP/1.1
Host: api.ycloud.com
X-API-Key: YOUR_API_KEY

πŸ“˜

How do I get my API Key?

Log in to YCloud Dashboard > Developers and you will find it on that page.

Test with cURL

cURL is a command-line tool and library for transferring data with URLs. Here is an example of how to retrieve your account balance authenticated with your API key:

curl -X GET 'http://api.ycloud.com/v2/balance' \
-H 'X-API-Key: YOUR_API_KEY'

It returns a response with HTTP status 200 if succeeded. Here is an example of the response body:

{
  "amount": 190.07658,
  "currency": "USD"
}

Otherwise, it returns a response with HTTP status 401 if the API key is invalid. Here is an example of the response body:

{
  "error": {
    "status": 401,
    "code": "UNAUTHORIZED",
    "message": "INVALID_API_KEY",
    "requestId": "req_1KjtKI80IKoaJNa6n6p"
  }
}