Shiprocket Integration — Fulfillment API Reference
ShipmentService.CreateShipment runs five Shiprocket calls in a fixed order, one gRPC-auth’d OAuth2 token (from provider-auth-service) reused across all five: CreateOrder → AssignAWB → GenerateLabel → PrintInvoice → GeneratePickup. Each is its own repository/shiprocket/ method — see shipment-service’s “CreateShipment implementation” section for why it’s split this way. This page is the request/response shape for each step.
Base URL: https://apiv2.shiprocket.in/v1/external (overridable per endpoint — see shipment-service’s “Local development — Shiprocket mock mode” section). Every call sends Authorization: Bearer <token>.
Step 1 — POST /orders/create/adhoc
Built from the order’s checkout_session snapshot plus the resolved shipping/billing address (see shipment-service’s “Secure PII resolution” section — the address fields below are illustrative, not a real customer’s data):
{
"order_id": "4SfjtmhNCQoJ2hFQxlDfMIKQ3OU9:6a91385a1704c89725dfc054",
"order_date": "2026-09-03 12:47",
"pickup_location": "Kochi Warehouse",
"billing_customer_name": "Anita Menon",
"billing_address": "14/220, Marine Drive Road",
"billing_city": "Kochi",
"billing_pincode": "682011",
"billing_state": "Kerala",
"billing_country": "India",
"billing_phone": "9000000000",
"shipping_is_billing": false,
"shipping_customer_name": "Anita Menon",
"shipping_address": "New Delhi Central FC Drop Point, Connaught Place",
"shipping_city": "New Delhi",
"shipping_pincode": "110001",
"shipping_state": "Delhi",
"shipping_country": "India",
"shipping_phone": "9000000000",
"order_items": [
{ "name": "Classic Terracotta Leather Dome Satchel", "sku": "210fd40e-312b-4708-a2a7-ddd02c7e040d", "units": 1, "selling_price": 185 }
],
"payment_method": "UPI",
"sub_total": 185,
"weight": 0.53
}
Three things worth knowing if you’re reading this to debug a mismatch:
order_idis sent as"<tenant_id>:<order_id>", on purpose — it’s the only identifier the tracking webhook later receives, so this composite lets the webhook handler recover both without a second lookup.shipping_is_billingis hardcodedfalseon every call, even when the two addresses are identical — never read from the order’s own “same as shipping” flag.payment_methodis passed through verbatim (e.g."UPI") — there’s no translation to Shiprocket’s ownPrepaid/CODvocabulary.
Step 2 — POST /courier/assign/awb
{ "shipment_id": "391822765" }
Response (Shiprocket sends one of two shapes; the nested one is preferred, the flat one is a fallback):
{
"awb_assign_status": 1,
"response": {
"data": {
"awb_code": "141123456789",
"courier_name": "Delhivery",
"courier_company_id": 24,
"shipment_id": 391822765
}
}
}
A non-2xx response whose body contains “already assigned” (case-insensitive) is treated as a success and the AWB/courier are parsed out of it anyway, rather than failing the call.
Known gap — the customer’s chosen tier never reaches this call
AssignAWB sends only {shipment_id} — never a courier_id. Tracing the customer’s Standard/Express selection through the system: it’s read from shipment_info at checkout, persisted onto the order correctly, but the mapper that builds the gRPC request for CreateShipment (toCheckoutSagaInput) has no courier/service-level field to carry it, and neither does CreateShipmentRequest in shipment.proto nor AssignAWB’s own request DTO. The practical effect: Shiprocket auto-assigns a courier using its own panel priority rules, which can differ from the courier implied by the tier the customer picked — there’s no reconciliation step that checks the two against each other. This isn’t yet filed as its own technical debt entry; the existing TD set in this app predates the trace above.
Concretely, omitting courier_id means every call takes Shiprocket’s Automated Allocation path: the Shiprocket account’s own dashboard “Courier Priority” setting (Recommended/Cheapest/Fastest/Custom) decides the carrier, not this request. Passing an explicit courier_id (sourced from a prior GetServiceability call) would switch to Explicit Allocation and bypass that dashboard setting entirely — which is the shape a future fix for this gap would take.
A separate, real failure mode on this same call: Shiprocket enforces account-level KYC verification before any AWB can be generated, independent of this request’s shape — an unverified account gets a 400 with "KYC verification is mandated for your account to ship an order." regardless of what’s in the payload. mock-service’s kyc-blocked scenario (see mock-service’s scenario table) simulates exactly this response for local testing.
Step 3 — POST /courier/generate/label
{ "shipment_id": [391822765] }
{ "label_created": 1, "label_url": "https://shiprocket-cdn.com/labels/391822765.pdf", "response": "Label generated successfully" }
Shiprocket accepts an array here to allow batch label generation — shipment-service always sends a single-element array.
Step 4 — POST /orders/print/invoice
Takes Shiprocket order IDs, not shipment IDs — easy to mix up with Step 3’s payload shape since both are integer arrays:
{ "ids": [384910234] }
{ "is_invoice_created": true, "invoice_url": "https://shiprocket-cdn.com/invoices/384910234.pdf", "not_created": [] }
Step 5 — POST /courier/generate/pickup
{ "shipment_id": [391822765] }
{
"pickup_status": 1,
"response": {
"pickup_scheduled_date": "2026-09-11 10:00:00",
"pickup_token_number": "PKP141123456",
"status": "Pickup Scheduled"
}
}
label_url, invoice_url, and pickup_token_number are logged and audited but not surfaced on CreateShipmentResponse — no caller needs them today.
If a step fails
Each step’s outcome — success or failure — is persisted into shipment_shiprocket_orders independently of the audit-trail publish (see shipment-service’s “Document audit trail” section), and AssignAWB specifically retries across the selected tier’s fallback_courier_ids (from the serviceability step) before giving up. There is currently no RPC to read that per-order status back — see TD-06.
Related Documents
- Hub — Shiprocket Integration
- Serviceability & Shipping Tiers — previous step: where
internal_courier_id/fallback_courier_idscome from - Tracking Webhook Reference — next: what happens after
GeneratePickup, once the courier starts scanning the package - Technical Debt — Multi-Courier Fulfillment Gaps
- shipment-service