Quickstart

This page gets you a working API call in under a minute.

Step 1 — Get an API token#

  1. Sign in to your Ocean.io account
  2. Go to Account Settings → API Tokens
  3. Click Generate new token and copy it

See Authentication for more detail.

Step 2 — Check your credit balance#

Paste this into your terminal (replace YOUR_API_TOKEN):

curl -X GET "https://api.ocean.io/v2/credits/balance" \
  -H "X-Api-Token: YOUR_API_TOKEN"
import requests

response = requests.get(
    'https://api.ocean.io/v2/credits/balance',
    headers={'X-Api-Token': 'YOUR_API_TOKEN'},
).json()
const response = await fetch('https://api.ocean.io/v2/credits/balance', {
  headers: { 'X-Api-Token': 'YOUR_API_TOKEN' },
}).then(r => r.json());

Step 3 — Expected response#

{
  "credits": { "oneTime": 0, "recurrent": 10000 },
  "emailCredits": { "oneTime": 0, "recurrent": 0 },
  "phoneCredits": { "oneTime": 0, "recurrent": 0 },
  "previewCredits": { "oneTime": 0, "recurrent": 0 },
  "dailyLimitRateLeft": 1000,
  "dailyLimitRateSecondsToReset": 86400
}

A 200 OK with recurrent > 0 means you're ready.

What's next?#