Using Sandbox to test connectivity and API keys

Use the Circle sandbox to check your connectivity and verify your API key.

Circle’s sandbox environment is a development tool that allows you to safely test prototypes and integration without generating actual financial transactions. Sandbox APIs match those in production, making it easy to move into the production phase.

  • Before running these tests, make sure that you have a sandbox account and an API key.

Testing Raw Connectivity

To test raw connectivity, hit the service health API endpoint by running the command below.

curl -H 'Accept: application/json' \
  -X GET --url https://api-sandbox.circle.com/ping
/** 
 * See installation instructions at 
 * https://developers.circle.com/developer/docs/circle-sdk
 */
import { Circle, CircleEnvironments } from "@circle-fin/circle-sdk";

const circle = new Circle('', CircleEnvironments.sandbox);

async function testApi() {
    const pingResp = await circle.health.ping();
    console.log(pingResp.data);
}
testApi();

👍

Successful Response

If you reached the API endpoint, you’ll see the response
{"message" : "pong"}.

Testing Your API Key

Verify that your API key is set up correctly by running the command below to hit a read endpoint (in this case, the configuration endpoint).

curl -H 'Accept: application/json' \
  -H "Authorization: Bearer ${YOUR_API_KEY}" \
  -X GET --url https://api-sandbox.circle.com/v1/configuration
/** 
 * See installation instructions at 
 * https://developers.circle.com/developer/docs/circle-sdk
 */
import { Circle, CircleEnvironments } from "@circle-fin/circle-sdk";

const circle = new Circle(
    '<your-api-key>',
    CircleEnvironments.sandbox
);

async function getAccountConfig() {
    const configResp = await circle.management.getAccountConfig();
    console.log(configResp.data);
}
getAccountConfig();

👍

Successful Response

{"data":{"payments":{"masterWalletId":"1234567890"}}}

❗️

Error Response

{"code":401,"message":"Malformed authorization. Are the credentials properly encoded?"}