Make your first request
Call GET /v1/me with your key, read the answer, then list your first products.
Version v1.1, updated
GET /v1/me tells you which company and which key a request uses. It needs no scope, so it is the right first call for a new key.
Call GET /v1/me
Put the key in the BIRP_API_KEY environment variable, then run one of these.
GET /v1/me
curl "https://api.birp.io/v1/me" \
-H "Authorization: Bearer $BIRP_API_KEY"const response = await fetch("https://api.birp.io/v1/me", {
headers: {
Authorization: `Bearer ${process.env.BIRP_API_KEY}`,
},
});
if (!response.ok) throw new Error(`BIRP API error ${response.status}`);
const result = await response.json();<?php
$ch = curl_init("https://api.birp.io/v1/me");
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("BIRP_API_KEY"),
],
CURLOPT_RETURNTRANSFER => true,
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);import os
import requests
response = requests.request(
"GET",
"https://api.birp.io/v1/me",
headers={
"Authorization": f"Bearer {os.environ['BIRP_API_KEY']}",
},
timeout=10,
)
response.raise_for_status()
result = response.json()200 OKJSON
{
"data": {
"company": {
"base_currency": "MDL",
"country_code": "MD",
"id": "00000000-0000-4000-8000-000000000001",
"name": "Brutaria Exemplu SRL"
},
"key": {
"expires_at": "2027-10-05T00:00:00.000Z",
"name": "WooCommerce sync",
"prefix": "EXAMPLE-PREFIX",
"scopes": [
"products:read",
"stock:read",
"orders:read"
]
},
"rate_limits": {
"per_company_per_minute": 1200,
"per_key_per_minute": 600,
"window_seconds": 60
}
}
}Read the answer
List your first products
With a key that has products:read, ask for the first five products.
GET /v1/products
curl "https://api.birp.io/v1/products?limit=5" \
-H "Authorization: Bearer $BIRP_API_KEY"const response = await fetch("https://api.birp.io/v1/products?limit=5", {
headers: {
Authorization: `Bearer ${process.env.BIRP_API_KEY}`,
},
});
if (!response.ok) throw new Error(`BIRP API error ${response.status}`);
const result = await response.json();<?php
$ch = curl_init("https://api.birp.io/v1/products?limit=5");
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("BIRP_API_KEY"),
],
CURLOPT_RETURNTRANSFER => true,
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);import os
import requests
response = requests.request(
"GET",
"https://api.birp.io/v1/products",
params={"limit": 5},
headers={
"Authorization": f"Bearer {os.environ['BIRP_API_KEY']}",
},
timeout=10,
)
response.raise_for_status()
result = response.json()Lists come in data, with meta for the next page. Pagination and filtering explains how to read every page.
What can go wrong
Related
- me-and-tax-codes
- pagination-and-filtering
- errors-overview