Examples

Code Examples

Copy-paste examples for common languages. Replace your_api_key_here with your actual key. All examples include pagination handling.

Python

import requests

BASE_URL = "https://api.apeek.io/api/v1"

params = {
    "series": "initial_claims_sa,continued_claims_sa",
    "date_from": "2025-01-01",
    "date_to": "2026-01-01",
    "api_key": "your_api_key_here"
}

all_records = []
response = requests.get(
    f"{BASE_URL}/economic-data/ui_weekly_claims",
    params=params
)
response.raise_for_status()
result = response.json()
all_records.extend(result["data"])

# Follow pagination until next_url is null
while result["pagination"].get("next_url"):
    response = requests.get(
        f"{BASE_URL}{result['pagination']['next_url']}"
    )
    response.raise_for_status()
    result = response.json()
    all_records.extend(result["data"])

print(f"Total records: {len(all_records)}")

cURL

Single request:

curl "https://api.apeek.io/api/v1/economic-data/jolts?series=job_openings_level_sa&date_from=2025-01-01&date_to=2026-01-01&api_key=your_api_key_here"

Multiple series:

curl "https://api.apeek.io/api/v1/economic-data/us_debt?series=debt_held_by_public,total_public_debt_outstanding&date_from=2025-01-01&date_to=2026-01-01&api_key=your_api_key_here"

JavaScript (fetch)

const BASE_URL = "https://api.apeek.io/api/v1";

const params = new URLSearchParams({
  series: "initial_claims_sa",
  date_from: "2025-01-01",
  date_to: "2026-01-01",
  api_key: "your_api_key_here"
});

let allRecords = [];
let response = await fetch(
  `${BASE_URL}/economic-data/ui_weekly_claims?${params}`
);
let result = await response.json();
allRecords.push(...result.data);

// Follow pagination until next_url is null
while (result.pagination.next_url) {
  response = await fetch(
    `${BASE_URL}${result.pagination.next_url}`
  );
  result = await response.json();
  allRecords.push(...result.data);
}

console.log(`Total records: ${allRecords.length}`);

R

library(httr)
library(jsonlite)

base_url <- "https://api.apeek.io/api/v1"

response <- GET(
  paste0(base_url, "/economic-data/us_debt"),
  query = list(
    series = "total_public_debt_outstanding",
    date_from = "2025-01-01",
    date_to = "2026-01-01",
    api_key = "your_api_key_here"
  )
)

result <- fromJSON(content(response, "text"))
all_records <- result$data

# Follow pagination until next_url is NULL
while (!is.null(result$pagination$next_url)) {
  response <- GET(paste0(base_url, result$pagination$next_url))
  result <- fromJSON(content(response, "text"))
  all_records <- rbind(all_records, result$data)
}

cat("Total records:", nrow(all_records), "\n")