Auth examples

PowerShell

$key = 'esk_live.123a123a'
$uri  = 'https://api.emigro.co/public/emigroswap/quote'
$hdrs = @{ 'x-api-key' = $key; 'Content-Type' = 'application/json' }

curl

curl -X POST 'https://api.emigro.co/public/emigroswap/quote' \
  -H 'x-api-key: esk_live.123a123a' \
  -H 'Content-Type: application/json' \
  -d '{"fromTokenAddress":"0x...","toTokenAddress":"0x...","amount":"100","chainId":8453}'

Node.js (axios)

import axios from "axios";

const res = await axios.post(
  "https://api.emigro.co/public/emigroswap/quote",
  {
    fromTokenAddress: "0x833589fCD6EdB6E08F4c7C32D4f71B54bDa02913",
    toTokenAddress: "0x0b3e328455c4059EEb9e3f84b5543F74E24e7E1b",
    amount: "100.00",
    chainId: 8453,
    slippage: 0.5
  },
  {
    headers: { "x-api-key": "esk_live.123a123a" }
  }
);

console.log(res.data);

Common Authentication Errors

Code
Error
Meaning

401 Unauthorized

Missing API key

Header x-api-key is not present

401 Unauthorized

Invalid API key

Key hash not found or malformed

403 Forbidden

API key disabled

The key exists but is inactive

429 Too Many Requests

Daily quota exhausted

The key exceeded its allowed quota

Last updated