API Documentation
Compare rates, create shipments, and manage pickups and tracking directly from your own system, storefront, or backend.
Introduction
The Yellohu public API lets you integrate rate quoting, shipment creation, pickups, and tracking directly into your own system, storefront, or backend, with no need to go through the dashboard.
Every call uses JSON over HTTPS, base URL https://yellohu.com/api/v1. Keys are created and managed from the dashboard, under Integrazioni → API.
Every section below has an interactive console: paste your Sandbox key and try the call for real, right from this page.
Want to use it with an AI assistant instead of writing code? See the MCP documentation.
See the MCP documentation →Authentication
Every request must include the X-Api-Key header with your API key. Keys come in two distinct environments: yh_test_... for Sandbox (no real charges, no real shipments) and yh_live_... for Production.
There is no separate Sandbox server: the same base URL responds to both test and live keys. The key's prefix determines the behavior: a yh_test_ key can never trigger a real charge or a real courier booking, by construction.
You can have at most one active key per environment. Generating a new one immediately invalidates the previous one: manage them from the dashboard.
Sandbox & production
In Sandbox (yh_test_... key), POST /shipments and POST /pickups never call a real courier or charge real money: they respond deterministically with a fake tracking number (TEST-...) and a placeholder label.
GET /rates and GET /pickup-points are real even in Sandbox: real rates and real pickup points, so you can test your integration against realistic data before going live.
In Production (yh_live_... key), shipments created via the API follow the same flow as checkout-created ones: the order is created and charged, but courier booking happens on Yellohu's side (not synchronously). The label arrives by email or webhook once ready, not in the call's response.
With a yh_test_ key the draft is not saved: the request runs every check and the pricing as in production, then responds with draft_id: null and sandbox: true.
yh_test_ keys do not see your account's real drafts, not even those created on the website: GET /shipments?status=draft returns an empty list with sandbox: true, and GET, PATCH and DELETE of a draft (D123) return 404. To try listing, editing and deleting drafts use a yh_live_ key: a draft charges nothing.
Payments
Before creating shipments in production you need to set a default payment method from the dashboard (Integrazioni → API → Pagamento API): a saved card, gettoni (Yellohu credits), or deferred billing if your account is enabled for it.
Without a configured method, POST /shipments with payment:"now" returns 402 no_payment_method before the order is even created.
With the "deferred" method, the order is never charged immediately: it enters the monthly consolidated invoice, exactly like checkout-created orders using the same method. The response has charged: null and billing_mode: "deferred".
With payment:"draft" the shipment is neither paid nor sent: it becomes a draft in your account's cart, on yellohu.com and in the customer area (app.yellohu.com), where it is completed and paid together with the others. No order and no charge until you pay it from the cart.
A draft lasts 30 days from its last save, then it leaves the cart. You can have at most 100 active drafts and 500 saved in the last 30 days (deleted ones count too): beyond that the request returns 409 too_many_drafts. For active drafts, deleting some is enough; for the 500 limit, contact support.
A draft created via the API is normally ready to pay. Insurance is added only if you ask for it (optionals.insurance with the value): without it the draft has no insurance. The parcel shape comes from the fuori_sagoma and nonStackable optionals: without them the parcel is standard and stackable. Everything can be changed in the cart before paying. complete is true when the draft is ready to pay, and missing lists what is missing (in Italian, the same sentences the cart shows). There is no payment via the API: drafts are paid from the cart.
payment:"later" is the old name of "draft" and does exactly the same thing: it keeps working, but new integrations should use "draft". Below, the response for a draft.
{ "draft_id": "D123", "status": "draft", "complete": true, "missing": [], "expires_at": "2026-11-27T10:00:00.000Z", "merchant_reference": "ORD-10234", "breakdown": { "transport": 8.90, "surcharges": [], "optionals": [] } }
Idempotency
POST /shipments supports the Idempotency-Key header. If your network times out and you're not sure the request went through, you can retry it identically with the same key: if the order already exists, you get back the same response instead of creating (and charging) a second shipment.
Use a unique value for every new order (e.g. a UUID you generate): not your merchantReference, which may repeat for other reasons.
Drafts (payment:"draft") work the same way: the same key gives back the same draft without creating another. If that draft has since been deleted, paid or has expired, it does not come back: the response is 409 draft_not_active, with draft_id and status (deleted, converted or expired). To create another one, use another key.
curl -X POST https://yellohu.com/api/v1/shipments \
-H "X-Api-Key: yh_test_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 8f14e45f-ceea-467e-b7b1-6d9f5a4c1a2b" \
-d '{ ... }'Rate limits
Limits apply per API key, not per IP. If exceeded, you get 429 with { "error": { "code": "rate_limited" } }.
| Tier | Limit | Endpoints |
|---|---|---|
| Read | 60 requests / minute | GET /shipments, GET /shipments/{id}, GET /shipments/{id}/tracking, GET /pickups/{id}, GET /pickup-points, GET /optional-services, GET /services |
| Write | 20 requests / minute | POST /shipments, POST /rates, POST /pickups, PATCH /shipments/{id}, DELETE /shipments/{id} |
Errors
Every error has the same shape: { "error": { "code": "...", "message"?: "..." } }. The code field is always present and meant to be handled programmatically; message (when present) is meant to be human-readable.
| Code | HTTP | Meaning |
|---|---|---|
| missing_api_key | 401 | The X-Api-Key header is missing. |
| invalid_api_key | 401 | Key is invalid, revoked, or has been replaced. |
| rate_limited | 429 | Rate limit exceeded for this key. |
| invalid_request | 400 | Invalid request body or missing required field. |
| invalid_locality | 400 | Postal code and city don't match (Italian address validation). |
| optional_not_available | 400 | Requested optional service isn't available for this courier/service. |
| invalid_optional_value | 400 | The value provided for an optional isn't valid (e.g. an FDD date outside the available window). |
| missing_locker_code | 400 | InPost locker service without recipient.lockerCode. |
| cargo_not_shippable | 422 | The described cargo cannot be shipped. |
| not_insurable | 422 | The described cargo isn't insurable via the applicable channel. |
| no_payment_method | 402 | No default payment method configured. |
| deferred_not_eligible | 403 | Deferred billing requested but the account isn't enabled for it. |
| payment_failed | 402 | Charge was declined or failed. |
| processing | 409 | An idempotent request is still in flight, retry (see the Retry-After header). |
| too_many_drafts | 409 | Too many drafts: at most 100 active and 500 saved in the last 30 days. |
| draft_in_payment | 409 | Draft being paid from the cart right now: retry in a moment. |
| draft_not_active | 409 | The draft for this Idempotency-Key was deleted, paid or has expired: use another key. |
| draft_converted | 409 | The draft has already been paid: it is now a shipment. |
| draft_not_editable | 409 | The draft was created on the website or in the customer area, or changed there: edit it there. |
| draft_changed | 409 | The draft changed while you were editing it: read it again and retry. |
| not_found | 404 | Resource doesn't exist or doesn't belong to you. |
| pickup_failed | 400 | Invalid pickup request. |
| cancellation_not_supported | 409 | Shipment already handed to the courier: can't be cancelled via API. |
| cannot_cancel | 400 | Shipment is in a state that doesn't allow cancellation. |
| invalid_courier | 400 | Unknown courier in the courier parameter. |
| internal_error | 500 | Internal error, retry or contact support. |
Endpoints
/api/v1/ratesRate quoting
Computes real rates from every available courier for a route and parcel, already discounted according to your price list.
Body
| Field | Type | Required | Description |
|---|---|---|---|
| origin | object | yes | { cap, city, country } |
| destination | object | yes | { cap, city, country } |
| packages | array | yes | 1 to 50 parcels: { weight (kg), length, width, height (cm) } |
| shipmentType | string | no | "pacchi" (default), "pallet", or "documenti". A pallet quoted as "pacchi" is priced as an oversized parcel (wrong margin and surcharges): use "pallet" for an 80-120cm base and/or 100kg+. |
| pickupDate | string | no | Requested pickup date, YYYY-MM-DD. Without it, each courier uses its first available pickup. For Poste it changes the price (monthly fuel surcharge, December peak): pass the same date to POST /api/v1/shipments. |
| optionals | object | no | E.g. { insurance: { value: 200 } }. Some optionals require a value (e.g. { fixedDeliveryDate: { date: "2026-07-22" } } for DHL): the real price of each selectable optional is in the response's available_optionals_detail. |
Possible errors
/api/v1/ratesRequest
{ "origin": { "cap": "20121", "city": "Milano", "country": "IT" }, "destination": { "cap": "00100", "city": "Roma", "country": "IT" }, "packages": [{ "weight": 5, "length": 30, "width": 20, "height": 15 }], "shipmentType": "pacchi" }
Response
{ "rates": [ { "courier": "BRT", "service": "express", "price": 8.90, "transit_days": 1, "estimated_pickup_date": "2026-09-15", "estimated_delivery_date": "2026-09-16", "delivery_time_commit": null, "available_optionals": ["insurance", "tailLiftPickup"], "available_optionals_detail": [ { "key": "insurance", "label": "Assicurazione", "price": 4.90, "requires": "goods_value" }, { "key": "tailLiftPickup", "label": "Sponda idraulica al ritiro", "price": 12.00 } ], "breakdown": { "transport": 8.90, "surcharges": [], "optionals": [] } } ] }
Try this call
/api/v1/optional-servicesOptional services catalog
Lists the optionals that actually affect price per courier: both the ones the courier bakes into its base rate (insurance, tail lift, etc.) and the ones summed additively on top of the base price (e.g. DHL fixedDeliveryDate/preAdvice, when enabled), only ones that also show up in available_optionals on POST /rates for that courier, never one that would then turn out unpriceable on a real quote. Labels are always returned in Italian (no per-key translation exists yet).
Query
| Field | Type | Required | Description |
|---|---|---|---|
| courier | string | no | E.g. brt: returns a flat array for that courier. If omitted, returns the catalog grouped per courier (see response). |
Possible errors
/api/v1/optional-servicesResponse
{ "optional_services": { "brt": [ { "key": "insurance", "label": "Assicurazione", "courier": "brt" }, { "key": "tailLiftPickup", "label": "Sponda idraulica al ritiro", "courier": "brt" }, { "key": "nonStackable", "label": "Non sovrapponibile", "courier": "brt" } ], "dhl": [ { "key": "tailLiftPickup", "label": "Sponda idraulica ritiro", "courier": "dhl" }, { "key": "tailLiftDelivery", "label": "Sponda idraulica consegna", "courier": "dhl" }, { "key": "nonStackable", "label": "Non sovrapponibile", "courier": "dhl" } ], "fedex": [ { "key": "insurance", "label": "Assicurazione", "courier": "fedex" }, { "key": "nonStackable", "label": "Non sovrapponibile", "courier": "fedex" } ], "poste": [ { "key": "insurance", "label": "Assicurazione", "courier": "poste" } ], "ups": [], "inpost": [], "palletways": [] } }
Try this call
/api/v1/servicesService catalog
Lists the shipping services we sell per courier, domestic and international together, with the human-readable name to show instead of the raw code (for example "FedEx® Priority Freight (Italia)" rather than FEDEX_PRIORITY_FREIGHT). These are the same services a real quote can return: it reads the configuration that drives the rate engine, so a service disabled in Yellohu never shows up here. No courier API call is made.
Query
| Field | Type | Required | Description |
|---|---|---|---|
| courier | string | no | E.g. fedex: returns a flat array for that courier. If omitted, returns the catalog grouped by courier (see response). |
Possible errors
/api/v1/servicesResponse
{ "services": { "brt": [ { "code": "express", "label": "BRT Express (Italia)", "courier": "brt" }, { "code": "priority", "label": "BRT Priority (Italia)", "courier": "brt" }, { "code": "002", "label": "BRT Euroexpress (Europa)", "courier": "brt" } ], "fedex": [ { "code": "FEDEX_PRIORITY", "label": "FedEx® Priority (Italia)", "courier": "fedex" }, { "code": "FEDEX_INTERNATIONAL_PRIORITY", "label": "FedEx International Priority", "courier": "fedex" } ], "dhl": [ { "code": "ECD", "label": "DHL Freight Domestic", "courier": "dhl" } ], "poste": [ { "code": "express_national", "label": "Poste Delivery Business Express (nazionale)", "courier": "poste" } ], "ups": [], "inpost": [ { "code": "inpost_locker", "label": "InPost Locker (punto di ritiro)", "courier": "inpost" } ], "palletways": [] } }
Try this call
/api/v1/shipmentsCreate shipment
Creates a shipment. With payment:"now" (default) the order is charged immediately via your default payment method; with payment:"draft" nothing is charged: a draft is added to your account's cart, to be paid on yellohu.com or in the customer area (see Payments); if something is missing, the missing field says what. "later" is the old name of "draft".
Body
| Field | Type | Required | Description |
|---|---|---|---|
| payment | "now" | "draft" | no | Defaults to "now". "draft": a draft in the cart, no charge (see Payments). "later" is also accepted, the old name of "draft". |
| courier | string | yes | E.g. "brt", case-insensitive. |
| service | string | yes | E.g. "express". |
| sender | object | yes | name, street, city, postalCode, countryCode (min 2), + optional company/province/phone/email. |
| recipient | object | yes | Same as sender. lockerCode only here, for InPost. |
| packages | array | yes | 1 to 50 parcels: weight (kg), length/width/height (cm). |
| shipmentType | string | no | "pacchi" (default), "pallet", or "documenti". A pallet created as "pacchi" is booked as an oversized parcel (wrong margin and surcharges). "documenti" exempts this shipment from shipmentPurpose/harmonizedCode for non-EU destinations (no commercial value). |
| content | string | yes | Cargo description, 2–2000 characters. With every courier, to a country with customs, a generic description ("Pants", "Merchandise", "Spare parts") is rejected with 422 vague_description: write what it is, what it is made of and what it is for (for example "men's cotton trousers"). |
| merchandiseValue | number | yes | Declared value of the goods, in EUR. |
| pickupDate | string | yes | YYYY-MM-DD. Required unless courier is "inpost". |
| pickupTimeSlot | "AM" | "PM" | "AMPM" | no | Defaults to "AMPM". |
| customs | object | no | Required for some non-EU destinations (see below), unless shipmentType:"documenti". |
| optionals | object | no | Selected optionals, see GET /optional-services. Some require a value (e.g. { fixedDeliveryDate: { date: "2026-07-22" } } for DHL, { insurance: { value: 200 } }). |
| merchantReference | string | no | Your own internal order reference (max 255 chars), echoed back in every response. |
Possible errors
/api/v1/shipmentsRequest
{ "payment": "now", "courier": "brt", "service": "express", "sender": { "name": "ACME Srl", "street": "Via Dante 1", "city": "Milano", "postalCode": "20121", "countryCode": "IT", "email": "shipping@acme.it" }, "recipient": { "name": "Mario Rossi", "street": "Via Roma 1", "city": "Roma", "postalCode": "00100", "countryCode": "IT" }, "packages": [{ "weight": 5, "length": 30, "width": 20, "height": 15 }], "shipmentType": "pacchi", "content": "Clothing", "merchandiseValue": 50, "pickupDate": "2026-07-15", "merchantReference": "ORD-10234" }
Response
{ "order_number": "O12433", "shipment_id": "S48213", "status": "created", "tracking_number": null, "label_url": null, "charged": { "amount": 10.86, "method": "saved_card" }, "merchant_reference": "ORD-10234", "breakdown": { "transport": 8.90, "surcharges": [], "optionals": [] } }
Try this call
/api/v1/shipmentsList shipments
Lists shipments created with this key, paginated. Drafts are not included: list them with status=draft.
Query
| Field | Type | Required | Description |
|---|---|---|---|
| limit | number | no | Defaults to 20, capped at 100. |
| offset | number | no | Defaults to 0. |
/api/v1/shipmentsResponse
{ "shipments": [ { "shipment_id": "S102", "status": "managed", "tracking_number": "BRT123", "courier": "BRT", "service": "Express", "merchant_reference": "ORD-10234" } ], "has_more": false }
Try this call
/api/v1/shipments/{id}Shipment detail
Status, tracking number, and label for a shipment.
Possible errors
/api/v1/shipments/{id}Response
{ "shipment_id": "S48213", "status": "managed", "tracking_number": "BRT123456", "label_url": "https://yellohu.com/.../label.pdf", "merchant_reference": "ORD-10234" }
Try this call
/api/v1/shipments/{id}Cancel shipment
Cancels a shipment, only if the courier hasn't picked it up yet.
Possible errors
/api/v1/shipments/{id}Response
{ "status": "cancelled" }
Try this call
/api/v1/shipments?status=draftList drafts
Lists your account's drafts, the same ones in the cart on yellohu.com and in the customer area (including those created on the website), most recent first. Expired, deleted or already paid drafts are not included. With a yh_test_ key the list is empty (see Sandbox).
Query
| Field | Type | Required | Description |
|---|---|---|---|
| status | "draft" | yes | "draft" for drafts. Without status, or with any other value (ignored), the list is the shipment one. |
| limit | number | no | Defaults to 20, max 100. |
| offset | number | no | Defaults to 0. |
/api/v1/shipments?status=draftResponse
{ "drafts": [ { "draft_id": "D123", "status": "draft", "complete": true, "courier": "BRT", "total_price_cents": 1086, "...": "..." } ], "has_more": false }
Try this call
/api/v1/shipments/{id}Draft detail
One of your account's drafts: id starting with D (e.g. D123). Addresses, parcels, courier, VAT-inclusive price in cents, whether it is complete and what is missing. created_via says whether it was created via the API or on the website. With an id starting with S, or just a number, the endpoint stays the shipment one.
Possible errors
/api/v1/shipments/{id}Response
{ "draft_id": "D123", "status": "draft", "readable": true, "complete": true, "missing": [], "created_via": "api", "courier": "BRT", "service": "express", "service_name": "BRT Express", "sender": { "name": "ACME Srl", "company": "", "street": "Via Dante 1", "city": "Milano", "postalCode": "20121", "province": "MI", "countryCode": "IT", "phone": "", "email": "spedizioni@acme.it" }, "recipient": { "name": "Mario Rossi", "company": "", "street": "Via Roma 1", "city": "Roma", "postalCode": "00100", "province": "RM", "countryCode": "IT", "phone": "", "email": "" }, "packages": [{ "weight": 5, "length": 30, "width": 20, "height": 15 }], "shipmentType": "pacchi", "content": "Abbigliamento", "merchandiseValue": 50, "pickupDate": "2026-11-03", "pickupTimeSlot": "AMPM", "total_price_cents": 1086, "merchant_reference": "ORD-10234", "updated_at": "2026-10-28T10:00:00.000Z", "expires_at": "2026-11-27T10:00:00.000Z" }
Try this call
/api/v1/shipments/{id}Update draft
Changes a draft created via the API: id starting with D. Send only the fields to change, with the POST /shipments names: each one replaces the saved one entirely (a new sender replaces the whole sender). The resulting draft goes through the same checks and gets the same price as a creation, and its 30-day expiry starts again. A draft created on the website or in the customer area, or changed there afterwards, is edited there (409 draft_not_editable). With a yh_test_ key it returns 404.
Body
| Field | Type | Required | Description |
|---|---|---|---|
| sender, recipient | object | no | As in POST /shipments: the whole address. |
| packages | array | no | All parcels, 1 to 50. |
| courier, service | string | no | Courier and service: the price is recomputed. |
| optionals, customs | object | no | As in POST /shipments. |
| content, merchandiseValue, shipmentType | string | number | no | The goods. |
| pickupDate, pickupTimeSlot | string | no | The pickup. |
| merchantReference | string | no | Your own reference. |
Possible errors
/api/v1/shipments/{id}Request
{ "recipient": { "name": "Mario Rossi", "street": "Via Roma 10", "city": "Roma", "postalCode": "00199", "countryCode": "IT" } }
Response
{ "draft_id": "D123", "status": "draft", "complete": true, "missing": [], "expires_at": "2026-11-27T10:00:00.000Z", "merchant_reference": "ORD-10234", "breakdown": { "transport": 8.90, "surcharges": [], "optionals": [] } }
Try this call
/api/v1/shipments/{id}Delete draft
Deletes a draft from the cart, like "Elimina" on yellohu.com: id starting with D. A deleted draft can no longer be read (a second delete returns 404).
Possible errors
/api/v1/shipments/{id}Response
{ "draft_id": "D123", "status": "deleted" }
Try this call
/api/v1/shipments/{id}/trackingTracking events
History of tracking events already recorded (no live courier query).
Possible errors
/api/v1/shipments/{id}/trackingResponse
{ "events": [ { "status": "picked_up", "occurred_at": "2026-07-11T09:12:00Z", "location": "Milano MI" }, { "status": "delivered", "occurred_at": "2026-07-12T14:03:00Z", "location": "Roma RM" } ] }
Try this call
/api/v1/pickupsRequest pickup
Books (or rebooks) the pickup of a shipment that already has its label. The pickup is requested from the courier for the given date. The shipment must have a generated label; for some couriers an operator handles the booking (202 response). Only the listed fields are accepted: an unknown field (for example shipmentId instead of shipment_id) returns invalid_request.
Body
| Field | Type | Required | Description |
|---|---|---|---|
| shipment_id | string | yes | Shipment id, with or without the leading S (e.g. "S48213" or "48213"). |
| date | string | yes | Pickup date, format YYYY-MM-DD (e.g. "2026-07-15"). Always required. |
| slot | "AM" | "PM" | "AMPM" | no | Time slot. Default "AMPM". |
| notes | string | no | Notes for the courier about the pickup. |
Possible errors
/api/v1/pickupsRequest
{ "shipment_id": "S48213", "date": "2026-07-15", "slot": "AM", "notes": "Ring the Rossi bell" }
Response
// 201: pickup requested { "shipment_id": "S48213", "pickup_status": "pending" } // 202: an operator handles the rebooking { "shipment_id": "S48213", "status": "requires_manual", "message": "..." } // 201 in Sandbox (yh_test_... key): no real courier called { "shipment_id": "S48213", "pickup_status": "pending", "sandbox": true }
Try this call
/api/v1/pickups/{id}Pickup status
Status of the pickup of a shipment (id = shipment id, with or without the leading S). pickup_status is null if no pickup was ever requested. In Sandbox, sandbox: true is also returned.
Possible errors
/api/v1/pickups/{id}Response
{ "shipment_id": "S48213", "pickup_date": "2026-07-15", "pickup_status": "pending" }
Try this call
/api/v1/pickup-pointsSearch pickup points
Searches lockers and pickup/drop-off points near a postal code or address.
Query
| Field | Type | Required | Description |
|---|---|---|---|
| postalCode | string | no | One of postalCode or address is required. |
| address | string | no | Free-text address, alternative to postalCode. |
| countryCode | string | no | Defaults to "IT". |
| radius | number | no | Search radius in meters. |
| courier | string | no | Filter by courier. |
| limit | number | no | Maximum number of results. |
Possible errors
/api/v1/pickup-pointsResponse
{ "points": [ { "courier": "INPOST", "point_id": "KRA010M", "type": "locker", "name": "Locker Milano Centrale", "address": { "street": "Piazza Duca d'Aosta", "city": "Milano", "postal_code": "20124", "country_code": "IT" }, "is_247": true, "distance_meters": 320 } ], "source": "live" }
Try this call