API
This page documents how shipment request identifier fields are normalized before validation and booking. The behavior here is based on the current pipeline in the api repository.
Resolution Order
Shipment requests are normalized in this order:
organizationIdcan switch the tenant context to a descendant organization.senderIdandreceiverIdtry to fillsenderandreceiver.organizationIdcan fillsenderfrom the selected organization profile whensenderandsenderIdare missing.consignmentTemplateIdor auto-apply templates are merged into the request.- a service-specific pickup address can fill
pickupAddress. senderAddressIdandreceiverAddressIdcan overwritesenderandreceiverlate in the pipeline.freightPayerIdorfreightPayer.customerNumbercan fillfreightPayerand carrier-contract context.
Later resolvers win over earlier ones.
Field Summary
| Field | Accepts | Resolves | Overwrite behavior |
|---|---|---|---|
organizationId | descendant organization ulid or quick_id | tenant context, sometimes sender | does not fill sender if senderId or sender is already present |
senderId | in practice a sender address quick_id | sender | if found, it replaces the inline sender payload |
receiverId | in practice a receiver address quick_id | receiver | if found, it replaces the inline receiver payload |
consignmentTemplateId | template id or quick_id | template payload | request wins in normal mode, template wins in override mode |
senderAddressId | address-book id or quick_id | sender | runs late, so it also overrides senderId and organization sender fill |
receiverAddressId | address-book id or quick_id | receiver | runs late, so it also overrides receiverId |
freightPayerId | address-book id or quick_id | freightPayer and contract context | only works when the address has a contract for the given serviceId |
organizationMemberId | existing organization_members.id | nothing | currently validation only |
organizationId
organizationId does not fetch a sender address from the address book. It first tries to switch tenant context.
Behavior:
- descendant organization
ulidorquick_idcan switch tenant context - numeric database
iddoes not switch tenant context - personal user tokens without organization context do not switch tenant
After the switch, sender is filled from the selected organization profile only when:
organizationIdis presentsenderIdis missing or emptysenderis missing or an empty array
Examples:
organizationIdonly: tenant switches andsenderis filled from the organization profileorganizationId+senderId: tenant switches, thensenderIddecidessenderorganizationId+sender: tenant switches, but explicitsenderstays
senderId and receiverId
senderId and receiverId run before consignment templates. If a lookup succeeds, the resolver rewrites the full sender or receiver payload.
Important details:
- the current fill pipe resolves these fields by
quick_id - unresolved values are normalized to
null - a successful lookup replaces any earlier inline party payload
Examples:
senderId+sender: resolvedsenderIdwinsreceiverId+receiver: resolvedreceiverIdwins- invalid
senderId+sender:senderIdbecomesnulland inlinesenderremains
Note
The validation rule accepts numeric address id or quick_id for senderId and receiverId, but the current fill pipe resolves them by quick_id. In practice these fields should use quick_id.
senderAddressId and receiverAddressId
senderAddressId and receiverAddressId are separate from senderId and receiverId.
Behavior:
- lookup is done in the tenant address book
- lookup accepts numeric address
idorquick_id - successful lookup replaces the full
senderorreceiverpayload receiverAddressIdcan also fillpreNoticeEmail,preNoticeSMS, anddeliveryInstructionssenderAddressIdcan also fillpickupInstructions
Because these run later than senderId and receiverId, they override earlier party resolution.
consignmentTemplateId
consignmentTemplateId accepts template id or quick_id. When a template resolves, the request is normalized to the template's real id.
Templates can apply:
- explicitly through
consignmentTemplateId - implicitly through auto-apply rules using
serviceId,isCompany, and in some casesreceiver.postcode
Merge rules:
- normal mode: request values win and the template fills gaps
- override mode: template values win
itemsandparcelsare merged per index using the same precedence- the template can fill missing
serviceId
freightPayerId
freightPayerId does not fill sender or receiver. It resolves third-party billing contract context.
Behavior:
- requires
serviceId - looks up an address-book address by
idorquick_id - only fills
freightPayerwhen the address has a carrier contract for that service - builds
freightPayermainly from receiver data plus the resolved customer number
If the request already has:
freightPayer.customerNumber- and
freightPayer.type = consignee
that path wins before freightPayerId lookup.
Recommended Usage
- use organization
ulidorquick_idfororganizationId - use
quick_idforsenderIdandreceiverId - use
senderAddressIdandreceiverAddressIdwhen you want the address book entry to win late in the pipeline - use
consignmentTemplateIdfor defaults or controlled override behavior - avoid sending multiple resolvers for the same party unless you intentionally want the documented priority order
