/api/v2.
All examples in these docs use staging. Set your env vars once, then every $RUN_BASE_URL call hits staging.
| Environment | Base URL |
|---|---|
| Staging | |
| Production |
Example keys
| Prefix | Environment | Host |
|---|---|---|
run_test_ | Staging | staging.rundeliverys.com |
run_live_ | Production | api.rundeliverys.com |
export RUN_BASE_URL={API_STAGING_URL}
export RUN_API_KEY=run_test_fce859d98c4f0e2b1e644d5a46e2fb9fb45bde58b36a0wfj
401.
When you go live, switch both values together:
export RUN_BASE_URL={API_PRODUCTION_URL}
export RUN_API_KEY=run_live_fce859d98c4f0e2b1e644d5a46e2fb9fb45bde58b36a0wfj
Making requests
Send JSON bodies withContent-Type: application/json. Always include your Bearer token.
curl "$RUN_BASE_URL/business/orders?limit=5" \
-H "Authorization: Bearer $RUN_API_KEY" \
-H "Content-Type: application/json"
const res = await fetch(`${process.env.RUN_BASE_URL}/business/order/cost`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RUN_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
pickup_address: '12 Admiralty Way, Lekki, Lagos',
dropoff_address: '15 Broad Street, Lagos Island, Lagos',
weight: 2,
}),
});
const data = await res.json();
import os
import requests
res = requests.post(
f"{os.environ['RUN_BASE_URL']}/business/order/cost",
headers={
"Authorization": f"Bearer {os.environ['RUN_API_KEY']}",
"Content-Type": "application/json",
},
json={
"pickup_address": "12 Admiralty Way, Lekki, Lagos",
"dropoff_address": "15 Broad Street, Lagos Island, Lagos",
"weight": 2,
},
)
data = res.json()
<?php
$ch = curl_init(getenv('RUN_BASE_URL') . '/business/order/cost');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RUN_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'pickup_address' => '12 Admiralty Way, Lekki, Lagos',
'dropoff_address' => '15 Broad Street, Lagos Island, Lagos',
'weight' => 2,
]),
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := []byte(`{
"pickup_address": "12 Admiralty Way, Lekki, Lagos",
"dropoff_address": "15 Broad Street, Lagos Island, Lagos",
"weight": 2
}`)
req, _ := http.NewRequest(
"POST",
os.Getenv("RUN_BASE_URL")+"/business/order/cost",
bytes.NewReader(body),
)
req.Header.Set("Authorization", "Bearer "+os.Getenv("RUN_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}
Store
RUN_API_KEY in environment variables on your server — never hard-code it in source.