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 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": [] }
}

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
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" } }.

TierLimitEndpoints
Read60 requests / minuteGET /shipments, GET /shipments/{id}, GET /shipments/{id}/tracking, GET /pickups/{id}, GET /pickup-points, GET /optional-services, GET /services
Write20 requests / minutePOST /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.

CodeHTTPMeaning
missing_api_key401The X-Api-Key header is missing.
invalid_api_key401Key is invalid, revoked, or has been replaced.
rate_limited429Rate limit exceeded for this key.
invalid_request400Invalid request body or missing required field.
invalid_locality400Postal code and city don't match (Italian address validation).
optional_not_available400Requested optional service isn't available for this courier/service.
invalid_optional_value400The value provided for an optional isn't valid (e.g. an FDD date outside the available window).
missing_locker_code400InPost locker service without recipient.lockerCode.
cargo_not_shippable422The described cargo cannot be shipped.
not_insurable422The described cargo isn't insurable via the applicable channel.
no_payment_method402No default payment method configured.
deferred_not_eligible403Deferred billing requested but the account isn't enabled for it.
payment_failed402Charge was declined or failed.
processing409An idempotent request is still in flight, retry (see the Retry-After header).
too_many_drafts409Too many drafts: at most 100 active and 500 saved in the last 30 days.
draft_in_payment409Draft being paid from the cart right now: retry in a moment.
draft_not_active409The draft for this Idempotency-Key was deleted, paid or has expired: use another key.
draft_converted409The draft has already been paid: it is now a shipment.
draft_not_editable409The draft was created on the website or in the customer area, or changed there: edit it there.
draft_changed409The draft changed while you were editing it: read it again and retry.
not_found404Resource doesn't exist or doesn't belong to you.
pickup_failed400Invalid pickup request.
cancellation_not_supported409Shipment already handed to the courier: can't be cancelled via API.
cannot_cancel400Shipment is in a state that doesn't allow cancellation.
invalid_courier400Unknown courier in the courier parameter.
internal_error500Internal error, retry or contact support.

Endpoints

POST/api/v1/rates

Rate quoting

Computes real rates from every available courier for a route and parcel, already discounted according to your price list.

Body

FieldTypeRequiredDescription
originobjectyes{ cap, city, country }
destinationobjectyes{ cap, city, country }
packagesarrayyes1 to 50 parcels: { weight (kg), length, width, height (cm) }
shipmentTypestringno"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+.
pickupDatestringnoRequested 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.
optionalsobjectnoE.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

400 invalid_request400 invalid_locality
POST/api/v1/rates

Request

JSON
{
  "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

200
{
  "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

GET/api/v1/optional-services

Optional 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

FieldTypeRequiredDescription
courierstringnoE.g. brt: returns a flat array for that courier. If omitted, returns the catalog grouped per courier (see response).

Possible errors

400 invalid_courier
GET/api/v1/optional-services

Response

200
{
  "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

GET/api/v1/services

Service 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

FieldTypeRequiredDescription
courierstringnoE.g. fedex: returns a flat array for that courier. If omitted, returns the catalog grouped by courier (see response).

Possible errors

400 invalid_courier
GET/api/v1/services

Response

200
{
  "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

POST/api/v1/shipments

Create 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

FieldTypeRequiredDescription
payment"now" | "draft"noDefaults to "now". "draft": a draft in the cart, no charge (see Payments). "later" is also accepted, the old name of "draft".
courierstringyesE.g. "brt", case-insensitive.
servicestringyesE.g. "express".
senderobjectyesname, street, city, postalCode, countryCode (min 2), + optional company/province/phone/email.
recipientobjectyesSame as sender. lockerCode only here, for InPost.
packagesarrayyes1 to 50 parcels: weight (kg), length/width/height (cm).
shipmentTypestringno"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).
contentstringyesCargo 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").
merchandiseValuenumberyesDeclared value of the goods, in EUR.
pickupDatestringyesYYYY-MM-DD. Required unless courier is "inpost".
pickupTimeSlot"AM" | "PM" | "AMPM"noDefaults to "AMPM".
customsobjectnoRequired for some non-EU destinations (see below), unless shipmentType:"documenti".
optionalsobjectnoSelected optionals, see GET /optional-services. Some require a value (e.g. { fixedDeliveryDate: { date: "2026-07-22" } } for DHL, { insurance: { value: 200 } }).
merchantReferencestringnoYour own internal order reference (max 255 chars), echoed back in every response.

Possible errors

400 invalid_request400 invalid_locality400 optional_not_available400 invalid_optional_value400 missing_locker_code422 cargo_not_shippable422 vague_description422 not_insurable402 no_payment_method403 deferred_not_eligible402 payment_failed409 too_many_drafts409 draft_not_active
POST/api/v1/shipments

Request

JSON
{
  "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

200
{
  "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

GET/api/v1/shipments

List shipments

Lists shipments created with this key, paginated. Drafts are not included: list them with status=draft.

Query

FieldTypeRequiredDescription
limitnumbernoDefaults to 20, capped at 100.
offsetnumbernoDefaults to 0.
GET/api/v1/shipments

Response

200
{
  "shipments": [
    {
      "shipment_id": "S102", "status": "managed", "tracking_number": "BRT123",
      "courier": "BRT", "service": "Express", "merchant_reference": "ORD-10234"
    }
  ],
  "has_more": false
}

Try this call

GET/api/v1/shipments/{id}

Shipment detail

Status, tracking number, and label for a shipment.

Possible errors

404 not_found
GET/api/v1/shipments/{id}

Response

200
{
  "shipment_id": "S48213",
  "status": "managed",
  "tracking_number": "BRT123456",
  "label_url": "https://yellohu.com/.../label.pdf",
  "merchant_reference": "ORD-10234"
}

Try this call

DELETE/api/v1/shipments/{id}

Cancel shipment

Cancels a shipment, only if the courier hasn't picked it up yet.

Possible errors

404 not_found409 cancellation_not_supported400 cannot_cancel
DELETE/api/v1/shipments/{id}

Response

200
{ "status": "cancelled" }

Try this call

GET/api/v1/shipments?status=draft

List 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

FieldTypeRequiredDescription
status"draft"yes"draft" for drafts. Without status, or with any other value (ignored), the list is the shipment one.
limitnumbernoDefaults to 20, max 100.
offsetnumbernoDefaults to 0.
GET/api/v1/shipments?status=draft

Response

200
{
  "drafts": [
    { "draft_id": "D123", "status": "draft", "complete": true, "courier": "BRT", "total_price_cents": 1086, "...": "..." }
  ],
  "has_more": false
}

Try this call

GET/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

404 not_found
GET/api/v1/shipments/{id}

Response

200
{
  "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

PATCH/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

FieldTypeRequiredDescription
sender, recipientobjectnoAs in POST /shipments: the whole address.
packagesarraynoAll parcels, 1 to 50.
courier, servicestringnoCourier and service: the price is recomputed.
optionals, customsobjectnoAs in POST /shipments.
content, merchandiseValue, shipmentTypestring | numbernoThe goods.
pickupDate, pickupTimeSlotstringnoThe pickup.
merchantReferencestringnoYour own reference.

Possible errors

400 invalid_request404 not_found405 method_not_allowed409 draft_not_editable409 draft_changed409 draft_in_payment
PATCH/api/v1/shipments/{id}

Request

JSON
{
  "recipient": { "name": "Mario Rossi", "street": "Via Roma 10", "city": "Roma", "postalCode": "00199", "countryCode": "IT" }
}

Response

200
{
  "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

DELETE/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

404 not_found409 draft_in_payment
DELETE/api/v1/shipments/{id}

Response

200
{ "draft_id": "D123", "status": "deleted" }

Try this call

GET/api/v1/shipments/{id}/tracking

Tracking events

History of tracking events already recorded (no live courier query).

Possible errors

404 not_found
GET/api/v1/shipments/{id}/tracking

Response

200
{
  "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

POST/api/v1/pickups

Request 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

FieldTypeRequiredDescription
shipment_idstringyesShipment id, with or without the leading S (e.g. "S48213" or "48213").
datestringyesPickup date, format YYYY-MM-DD (e.g. "2026-07-15"). Always required.
slot"AM" | "PM" | "AMPM"noTime slot. Default "AMPM".
notesstringnoNotes for the courier about the pickup.

Possible errors

400 invalid_request404 not_found400 pickup_failed
POST/api/v1/pickups

Request

JSON
{ "shipment_id": "S48213", "date": "2026-07-15", "slot": "AM", "notes": "Ring the Rossi bell" }

Response

200
// 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

GET/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

404 not_found
GET/api/v1/pickups/{id}

Response

200
{ "shipment_id": "S48213", "pickup_date": "2026-07-15", "pickup_status": "pending" }

Try this call

GET/api/v1/pickup-points

Search pickup points

Searches lockers and pickup/drop-off points near a postal code or address.

Query

FieldTypeRequiredDescription
postalCodestringnoOne of postalCode or address is required.
addressstringnoFree-text address, alternative to postalCode.
countryCodestringnoDefaults to "IT".
radiusnumbernoSearch radius in meters.
courierstringnoFilter by courier.
limitnumbernoMaximum number of results.

Possible errors

400 invalid_request400 invalid_locality
GET/api/v1/pickup-points

Response

200
{
  "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

API Documentation | Yellohu