Schnellstart
Fünf Schritte von der Registrierung bis zum ersten Label und Tracking. Die ersten drei Schritte sind kostenlos und funktionieren mit dem Testschlüssel.
1. Schlüssel erhalten
Registrieren Sie sich und öffnen Sie im Dashboard den Bereich „API“. Erstellen Sie einen Testschlüssel sk_test_… (zur Prüfung) und später einen Live-Schlüssel sk_live_… (für Käufe). Der Schlüssel wird nur einmal angezeigt, speichern Sie ihn. In den folgenden Beispielen wird er aus der Umgebungsvariable genommen.
export SHIPPICKUP_API_KEY=sk_test_your_key_here2. Verbindung prüfen
Die Methode ping ist offen und benötigt keinen Schlüssel, sie zeigt an, dass die API verfügbar ist.
curl https://api.shippickup.com/v1/ping \
-H "Authorization: Bearer $SHIPPICKUP_API_KEY"<?php
$ch = curl_init('https://api.shippickup.com/v1/ping');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SHIPPICKUP_API_KEY'),
],
]);
$response = json_decode((string) curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
print_r([$status, $response]);
import os
import requests
r = requests.get(
"https://api.shippickup.com/v1/ping",
headers={
"Authorization": "Bearer " + os.environ["SHIPPICKUP_API_KEY"],
},
timeout=30,
)
print(r.status_code, r.json())
const res = await fetch("https://api.shippickup.com/v1/ping", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.SHIPPICKUP_API_KEY}`,
},
});
console.log(res.status, await res.json());
{
"data": {
"status": "ok",
"version": "v1"
}
}3. Tarife erfahren
Übermitteln Sie Abhol- und Zielort sowie Paketparameter (Gewicht in Gramm, Maße in Millimetern, alles als ganze Zahlen). Die Antwort enthält Tarife aufsteigend nach Preis, jeder hat eine rate_id.
curl -X POST https://api.shippickup.com/v1/rates \
-H "Authorization: Bearer $SHIPPICKUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": {
"country": "US",
"postal_code": "10001",
"city": "New York"
},
"to": {
"country": "DE",
"postal_code": "10117",
"city": "Berlin"
},
"parcel": {
"weight_g": 800,
"length_mm": 250,
"width_mm": 180,
"height_mm": 80
},
"declared_value_cents": 5000
}'<?php
$body = [
'from' => [
'country' => 'US',
'postal_code' => '10001',
'city' => 'New York',
],
'to' => [
'country' => 'DE',
'postal_code' => '10117',
'city' => 'Berlin',
],
'parcel' => [
'weight_g' => 800,
'length_mm' => 250,
'width_mm' => 180,
'height_mm' => 80,
],
'declared_value_cents' => 5000,
];
$ch = curl_init('https://api.shippickup.com/v1/rates');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SHIPPICKUP_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($body),
]);
$response = json_decode((string) curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
print_r([$status, $response]);
import os
import requests
body = {
"from": {
"country": "US",
"postal_code": "10001",
"city": "New York",
},
"to": {
"country": "DE",
"postal_code": "10117",
"city": "Berlin",
},
"parcel": {
"weight_g": 800,
"length_mm": 250,
"width_mm": 180,
"height_mm": 80,
},
"declared_value_cents": 5000,
}
r = requests.post(
"https://api.shippickup.com/v1/rates",
headers={
"Authorization": "Bearer " + os.environ["SHIPPICKUP_API_KEY"],
},
json=body,
timeout=30,
)
print(r.status_code, r.json())
const body = {
"from": {
"country": "US",
"postal_code": "10001",
"city": "New York"
},
"to": {
"country": "DE",
"postal_code": "10117",
"city": "Berlin"
},
"parcel": {
"weight_g": 800,
"length_mm": 250,
"width_mm": 180,
"height_mm": 80
},
"declared_value_cents": 5000
};
const res = await fetch("https://api.shippickup.com/v1/rates", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SHIPPICKUP_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});
console.log(res.status, await res.json());
{
"data": [
{
"rate_id": "<rate_id>",
"carrier": "UPS",
"service": "Express Saver",
"price_cents": 4120,
"price": "41.20",
"currency": "USD",
"eta_days_min": 3,
"eta_days_max": 5,
"pickup_supported": true,
"chargeable_weight_g": 800
}
],
"meta": {
"count": 1,
"partial": false
}
}4. Label kaufen
Der Kauf funktioniert nur mit dem Live-Schlüssel und erfordert Guthaben auf dem Konto. Übermitteln Sie die rate_id des gewählten Tarifs, vollständige Adressen, Paket und Inhalt. Der Header Idempotency-Key ist Pflicht: Er schützt vor doppelter Abbuchung bei Wiederholung.
curl -X POST https://api.shippickup.com/v1/shipments \
-H "Authorization: Bearer $SHIPPICKUP_API_KEY" \
-H "Idempotency-Key: order-10452-label-v1" \
-H "Content-Type: application/json" \
-d '{
"rate_id": "<rate_id>",
"from": {
"name": "Acme Store",
"company": "Acme Inc",
"line1": "350 5th Ave",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US",
"phone": "+12125550100",
"email": "shipping@example.com"
},
"to": {
"name": "Anna Schmidt",
"line1": "Unter den Linden 1",
"city": "Berlin",
"postal_code": "10117",
"country": "DE",
"phone": "+493012345678",
"email": "anna@example.com"
},
"parcel": {
"weight_g": 800,
"length_mm": 250,
"width_mm": 180,
"height_mm": 80
},
"items": [
{
"description": "T-shirts",
"quantity": 2,
"unit_value_cents": 2500,
"origin_country": "US"
}
],
"declared_value_cents": 5000,
"reference": "ORDER-10452"
}'<?php
$body = [
'rate_id' => '<rate_id>',
'from' => [
'name' => 'Acme Store',
'company' => 'Acme Inc',
'line1' => '350 5th Ave',
'city' => 'New York',
'state' => 'NY',
'postal_code' => '10001',
'country' => 'US',
'phone' => '+12125550100',
'email' => 'shipping@example.com',
],
'to' => [
'name' => 'Anna Schmidt',
'line1' => 'Unter den Linden 1',
'city' => 'Berlin',
'postal_code' => '10117',
'country' => 'DE',
'phone' => '+493012345678',
'email' => 'anna@example.com',
],
'parcel' => [
'weight_g' => 800,
'length_mm' => 250,
'width_mm' => 180,
'height_mm' => 80,
],
'items' => [
[
'description' => 'T-shirts',
'quantity' => 2,
'unit_value_cents' => 2500,
'origin_country' => 'US',
],
],
'declared_value_cents' => 5000,
'reference' => 'ORDER-10452',
];
$ch = curl_init('https://api.shippickup.com/v1/shipments');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SHIPPICKUP_API_KEY'),
'Idempotency-Key: order-10452-label-v1',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($body),
]);
$response = json_decode((string) curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
print_r([$status, $response]);
import os
import requests
body = {
"rate_id": "<rate_id>",
"from": {
"name": "Acme Store",
"company": "Acme Inc",
"line1": "350 5th Ave",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US",
"phone": "+12125550100",
"email": "shipping@example.com",
},
"to": {
"name": "Anna Schmidt",
"line1": "Unter den Linden 1",
"city": "Berlin",
"postal_code": "10117",
"country": "DE",
"phone": "+493012345678",
"email": "anna@example.com",
},
"parcel": {
"weight_g": 800,
"length_mm": 250,
"width_mm": 180,
"height_mm": 80,
},
"items": [
{
"description": "T-shirts",
"quantity": 2,
"unit_value_cents": 2500,
"origin_country": "US",
},
],
"declared_value_cents": 5000,
"reference": "ORDER-10452",
}
r = requests.post(
"https://api.shippickup.com/v1/shipments",
headers={
"Authorization": "Bearer " + os.environ["SHIPPICKUP_API_KEY"],
"Idempotency-Key": "order-10452-label-v1",
},
json=body,
timeout=30,
)
print(r.status_code, r.json())
const body = {
"rate_id": "<rate_id>",
"from": {
"name": "Acme Store",
"company": "Acme Inc",
"line1": "350 5th Ave",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US",
"phone": "+12125550100",
"email": "shipping@example.com"
},
"to": {
"name": "Anna Schmidt",
"line1": "Unter den Linden 1",
"city": "Berlin",
"postal_code": "10117",
"country": "DE",
"phone": "+493012345678",
"email": "anna@example.com"
},
"parcel": {
"weight_g": 800,
"length_mm": 250,
"width_mm": 180,
"height_mm": 80
},
"items": [
{
"description": "T-shirts",
"quantity": 2,
"unit_value_cents": 2500,
"origin_country": "US"
}
],
"declared_value_cents": 5000,
"reference": "ORDER-10452"
};
const res = await fetch("https://api.shippickup.com/v1/shipments", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SHIPPICKUP_API_KEY}`,
"Idempotency-Key": "order-10452-label-v1",
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});
console.log(res.status, await res.json());
Die Antwort enthält die Bestellnummer id, den Spediteur, tracking_number und den Preis. Das PDF-Label wird per GET /shipments/{id}/label oder im Benutzerkonto im Bestellbereich heruntergeladen.
5. Verfolgen Sie das Paket
Geben Sie die Bestellnummer oder Sendungsverfolgungsnummer ein. Die Antwort enthält den Status und die Ereignisse des Versandwegs.
curl https://api.shippickup.com/v1/shipments/4f2a9c1e7b3d48a6c5e0f1d2b3/tracking \
-H "Authorization: Bearer $SHIPPICKUP_API_KEY"<?php
$ch = curl_init('https://api.shippickup.com/v1/shipments/4f2a9c1e7b3d48a6c5e0f1d2b3/tracking');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SHIPPICKUP_API_KEY'),
],
]);
$response = json_decode((string) curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
print_r([$status, $response]);
import os
import requests
r = requests.get(
"https://api.shippickup.com/v1/shipments/4f2a9c1e7b3d48a6c5e0f1d2b3/tracking",
headers={
"Authorization": "Bearer " + os.environ["SHIPPICKUP_API_KEY"],
},
timeout=30,
)
print(r.status_code, r.json())
const res = await fetch("https://api.shippickup.com/v1/shipments/4f2a9c1e7b3d48a6c5e0f1d2b3/tracking", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.SHIPPICKUP_API_KEY}`,
},
});
console.log(res.status, await res.json());
Was als Nächstes
- Verbinden Sie Webhooks, um Benachrichtigungen zu erhalten, anstatt die API abzufragen: Abschnitt „Webhooks“.
- Für CRM und Tabellen gibt es fertige Lösungen mit Dateien: Abschnitt „Fertige Lösungen“.
- Für den Massenkauf von Labels siehe „Häufige Szenarien“.