curl -OJ "$RUN_BASE_URL/business/orders/$ID/receipt" \
-H "Authorization: Bearer $RUN_API_KEY"
const res = await fetch(
`${process.env.RUN_BASE_URL}/business/orders/${orderId}/receipt`,
{
headers: {
Authorization: `Bearer ${process.env.RUN_API_KEY}`,
},
},
);
if (!res.ok) {
console.error(await res.json());
throw new Error(`Receipt failed: ${res.status}`);
}
const buffer = Buffer.from(await res.arrayBuffer());
const disposition = res.headers.get('content-disposition') || '';
const match = /filename="([^"]+)"/.exec(disposition);
const filename = match?.[1] || `receipt-${orderId}.pdf`;
require('fs').writeFileSync(filename, buffer);
import os
import re
import requests
order_id = os.environ["ORDER_ID"]
res = requests.get(
f"{os.environ['RUN_BASE_URL']}/business/orders/{order_id}/receipt",
headers={"Authorization": f"Bearer {os.environ['RUN_API_KEY']}"},
)
if res.status_code != 200:
print(res.json())
raise SystemExit(res.status_code)
disposition = res.headers.get("Content-Disposition", "")
match = re.search(r'filename="([^"]+)"', disposition)
filename = match.group(1) if match else f"receipt-{order_id}.pdf"
with open(filename, "wb") as f:
f.write(res.content)
<?php
$orderId = getenv('ORDER_ID');
$ch = curl_init(getenv('RUN_BASE_URL') . "/business/orders/{$orderId}/receipt");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RUN_API_KEY'),
],
CURLOPT_HEADER => true,
]);
$raw = curl_exec($ch);
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$headers = substr($raw, 0, $headerSize);
$body = substr($raw, $headerSize);
curl_close($ch);
if ($status !== 200) {
echo $body;
exit($status);
}
preg_match('/filename="([^"]+)"/', $headers, $m);
$filename = $m[1] ?? "receipt-{$orderId}.pdf";
file_put_contents($filename, $body);
package main
import (
"io"
"net/http"
"os"
"regexp"
)
func main() {
orderID := os.Getenv("ORDER_ID")
req, _ := http.NewRequest(
"GET",
os.Getenv("RUN_BASE_URL")+"/business/orders/"+orderID+"/receipt",
nil,
)
req.Header.Set("Authorization", "Bearer "+os.Getenv("RUN_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
if res.StatusCode != 200 {
os.Stdout.Write(body)
os.Exit(1)
}
filename := "receipt-" + orderID + ".pdf"
if m := regexp.MustCompile(`filename="([^"]+)"`).FindStringSubmatch(
res.Header.Get("Content-Disposition"),
); len(m) == 2 {
filename = m[1]
}
_ = os.WriteFile(filename, body, 0o644)
}
application/pdf (binary body)
Content-Type: application/pdf
Content-Disposition: attachment; filename="receipt-RUN-A1B2C3D4.pdf"
{
"statusCode": 400,
"timestamp": "2026-08-12T15:18:51.396Z",
"path": "/api/v2/business/orders/6a7c75f801df3fbb7fad0c58/receipt",
"message": "Receipt is only available for delivered trips"
}
{
"statusCode": 401,
"timestamp": "2026-08-12T15:18:51.396Z",
"path": "/api/v2/business/orders/6a7c75f801df3fbb7fad0c58/receipt",
"message": "Invalid API key"
}
{
"statusCode": 403,
"timestamp": "2026-08-12T15:18:51.396Z",
"path": "/api/v2/business/orders/6a7c75f801df3fbb7fad0c58/receipt",
"message": "Insufficient API key scope"
}
{
"statusCode": 404,
"timestamp": "2026-08-12T15:18:51.396Z",
"path": "/api/v2/business/orders/6a7c75f801df3fbb7fad0c58/receipt",
"message": "Order not found"
}
Download receipt
Download a PDF receipt for a delivered order.
GET
/
business
/
orders
/
:id
/
receipt
curl -OJ "$RUN_BASE_URL/business/orders/$ID/receipt" \
-H "Authorization: Bearer $RUN_API_KEY"
const res = await fetch(
`${process.env.RUN_BASE_URL}/business/orders/${orderId}/receipt`,
{
headers: {
Authorization: `Bearer ${process.env.RUN_API_KEY}`,
},
},
);
if (!res.ok) {
console.error(await res.json());
throw new Error(`Receipt failed: ${res.status}`);
}
const buffer = Buffer.from(await res.arrayBuffer());
const disposition = res.headers.get('content-disposition') || '';
const match = /filename="([^"]+)"/.exec(disposition);
const filename = match?.[1] || `receipt-${orderId}.pdf`;
require('fs').writeFileSync(filename, buffer);
import os
import re
import requests
order_id = os.environ["ORDER_ID"]
res = requests.get(
f"{os.environ['RUN_BASE_URL']}/business/orders/{order_id}/receipt",
headers={"Authorization": f"Bearer {os.environ['RUN_API_KEY']}"},
)
if res.status_code != 200:
print(res.json())
raise SystemExit(res.status_code)
disposition = res.headers.get("Content-Disposition", "")
match = re.search(r'filename="([^"]+)"', disposition)
filename = match.group(1) if match else f"receipt-{order_id}.pdf"
with open(filename, "wb") as f:
f.write(res.content)
<?php
$orderId = getenv('ORDER_ID');
$ch = curl_init(getenv('RUN_BASE_URL') . "/business/orders/{$orderId}/receipt");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RUN_API_KEY'),
],
CURLOPT_HEADER => true,
]);
$raw = curl_exec($ch);
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$headers = substr($raw, 0, $headerSize);
$body = substr($raw, $headerSize);
curl_close($ch);
if ($status !== 200) {
echo $body;
exit($status);
}
preg_match('/filename="([^"]+)"/', $headers, $m);
$filename = $m[1] ?? "receipt-{$orderId}.pdf";
file_put_contents($filename, $body);
package main
import (
"io"
"net/http"
"os"
"regexp"
)
func main() {
orderID := os.Getenv("ORDER_ID")
req, _ := http.NewRequest(
"GET",
os.Getenv("RUN_BASE_URL")+"/business/orders/"+orderID+"/receipt",
nil,
)
req.Header.Set("Authorization", "Bearer "+os.Getenv("RUN_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
if res.StatusCode != 200 {
os.Stdout.Write(body)
os.Exit(1)
}
filename := "receipt-" + orderID + ".pdf"
if m := regexp.MustCompile(`filename="([^"]+)"`).FindStringSubmatch(
res.Header.Get("Content-Disposition"),
); len(m) == 2 {
filename = m[1]
}
_ = os.WriteFile(filename, body, 0o644)
}
application/pdf (binary body)
Content-Type: application/pdf
Content-Disposition: attachment; filename="receipt-RUN-A1B2C3D4.pdf"
{
"statusCode": 400,
"timestamp": "2026-08-12T15:18:51.396Z",
"path": "/api/v2/business/orders/6a7c75f801df3fbb7fad0c58/receipt",
"message": "Receipt is only available for delivered trips"
}
{
"statusCode": 401,
"timestamp": "2026-08-12T15:18:51.396Z",
"path": "/api/v2/business/orders/6a7c75f801df3fbb7fad0c58/receipt",
"message": "Invalid API key"
}
{
"statusCode": 403,
"timestamp": "2026-08-12T15:18:51.396Z",
"path": "/api/v2/business/orders/6a7c75f801df3fbb7fad0c58/receipt",
"message": "Insufficient API key scope"
}
{
"statusCode": 404,
"timestamp": "2026-08-12T15:18:51.396Z",
"path": "/api/v2/business/orders/6a7c75f801df3fbb7fad0c58/receipt",
"message": "Order not found"
}
Download a PDF receipt. Only available for delivered orders (otherwise
400).
Requires scope: orders:read
The body is the PDF bytes. In cURL, -OJ saves the file using the Content-Disposition filename.
Headers
string
required
Bearer API key (
Bearer <api_key>).Path parameters
string
required
Order document id.
Response headers
string
Response header:
application/pdf.string
Response header:
attachment; filename="receipt-RUN-A1B2C3D4.pdf".curl -OJ "$RUN_BASE_URL/business/orders/$ID/receipt" \
-H "Authorization: Bearer $RUN_API_KEY"
const res = await fetch(
`${process.env.RUN_BASE_URL}/business/orders/${orderId}/receipt`,
{
headers: {
Authorization: `Bearer ${process.env.RUN_API_KEY}`,
},
},
);
if (!res.ok) {
console.error(await res.json());
throw new Error(`Receipt failed: ${res.status}`);
}
const buffer = Buffer.from(await res.arrayBuffer());
const disposition = res.headers.get('content-disposition') || '';
const match = /filename="([^"]+)"/.exec(disposition);
const filename = match?.[1] || `receipt-${orderId}.pdf`;
require('fs').writeFileSync(filename, buffer);
import os
import re
import requests
order_id = os.environ["ORDER_ID"]
res = requests.get(
f"{os.environ['RUN_BASE_URL']}/business/orders/{order_id}/receipt",
headers={"Authorization": f"Bearer {os.environ['RUN_API_KEY']}"},
)
if res.status_code != 200:
print(res.json())
raise SystemExit(res.status_code)
disposition = res.headers.get("Content-Disposition", "")
match = re.search(r'filename="([^"]+)"', disposition)
filename = match.group(1) if match else f"receipt-{order_id}.pdf"
with open(filename, "wb") as f:
f.write(res.content)
<?php
$orderId = getenv('ORDER_ID');
$ch = curl_init(getenv('RUN_BASE_URL') . "/business/orders/{$orderId}/receipt");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RUN_API_KEY'),
],
CURLOPT_HEADER => true,
]);
$raw = curl_exec($ch);
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$headers = substr($raw, 0, $headerSize);
$body = substr($raw, $headerSize);
curl_close($ch);
if ($status !== 200) {
echo $body;
exit($status);
}
preg_match('/filename="([^"]+)"/', $headers, $m);
$filename = $m[1] ?? "receipt-{$orderId}.pdf";
file_put_contents($filename, $body);
package main
import (
"io"
"net/http"
"os"
"regexp"
)
func main() {
orderID := os.Getenv("ORDER_ID")
req, _ := http.NewRequest(
"GET",
os.Getenv("RUN_BASE_URL")+"/business/orders/"+orderID+"/receipt",
nil,
)
req.Header.Set("Authorization", "Bearer "+os.Getenv("RUN_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
if res.StatusCode != 200 {
os.Stdout.Write(body)
os.Exit(1)
}
filename := "receipt-" + orderID + ".pdf"
if m := regexp.MustCompile(`filename="([^"]+)"`).FindStringSubmatch(
res.Header.Get("Content-Disposition"),
); len(m) == 2 {
filename = m[1]
}
_ = os.WriteFile(filename, body, 0o644)
}
application/pdf (binary body)
Content-Type: application/pdf
Content-Disposition: attachment; filename="receipt-RUN-A1B2C3D4.pdf"
{
"statusCode": 400,
"timestamp": "2026-08-12T15:18:51.396Z",
"path": "/api/v2/business/orders/6a7c75f801df3fbb7fad0c58/receipt",
"message": "Receipt is only available for delivered trips"
}
{
"statusCode": 401,
"timestamp": "2026-08-12T15:18:51.396Z",
"path": "/api/v2/business/orders/6a7c75f801df3fbb7fad0c58/receipt",
"message": "Invalid API key"
}
{
"statusCode": 403,
"timestamp": "2026-08-12T15:18:51.396Z",
"path": "/api/v2/business/orders/6a7c75f801df3fbb7fad0c58/receipt",
"message": "Insufficient API key scope"
}
{
"statusCode": 404,
"timestamp": "2026-08-12T15:18:51.396Z",
"path": "/api/v2/business/orders/6a7c75f801df3fbb7fad0c58/receipt",
"message": "Order not found"
}
⌘I