Перейти к содержимому

Create or update a courier by external id

POST
/api/couriers/sync
curl --request POST \
--url https://example.com/api/couriers/sync \
--header 'Content-Type: application/json' \
--data '{ "externalId": "example", "fullName": "example", "phone": "example", "email": "example", "additionalInfo": "example", "tags": [ "example" ], "transportId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "status": "Active" }'

Matches an existing courier by external id; answers 201 when no match is found and a new courier is created, 200 when an existing courier is updated. Fails with 409 when the matched courier is archived or has been erased.

Media typeapplication/json

A courier’s profile, pushed from an external system and matched by external id.

object
externalId
required

Your system’s id for this courier. Sending the same id again updates the courier instead of creating a second one.

string
fullName
required

The courier’s full name.

string
phone
required

The courier’s phone number.

string
email
required

The courier’s email address; omit if none.

null | string
additionalInfo
required

Free-text notes about the courier; omit if none.

null | string
tags
required

The courier’s capability-skill tags; omit or send an empty list for none.

Array<string> | null
transportId
required

The vehicle to permanently assign the courier to; omit for none.

null | string format: uuid
status
required
One of:
null

OK

Media typeapplication/json

The result of syncing a courier by external id.

object
courierId
required

The courier’s id — the same one on every later sync of this external id.

string format: uuid
outcome
required

Whether this call created a new courier (Created) or updated an existing one matched by external id (Updated).

Allowed values: Created Updated
Example
{
"outcome": "Created"
}

Created

Media typeapplication/json

The result of syncing a courier by external id.

object
courierId
required

The courier’s id — the same one on every later sync of this external id.

string format: uuid
outcome
required

Whether this call created a new courier (Created) or updated an existing one matched by external id (Updated).

Allowed values: Created Updated
Example
{
"outcome": "Created"
}

Validation failed

Media typeapplication/problem+json

The body of a 400 response, served as application/problem+json. It follows the RFC 9457 problem-details shape: type, title, status and detail are the standard members, and errors is an extension that lists the offending fields.

object
type
required

A stable, machine-readable code for the error. Branch on this rather than on the wording of the title or the detail.

string
title
required

A short label for the kind of failure, such as Validation failed.

string
status
required

The HTTP status code of the response, which for this body is 400.

integer format: int32
detail
required

A human-readable explanation of this particular failure, or null.

null | string
errors

The fields the request was rejected over, one entry each. Omitted entirely when the failure carries no field-level context, so a 400 can arrive without this member.

Array<object> | null

One field the request was rejected over.

object
field
required

The name of the offending field, spelled as the request body spells it.

string
code
required

A stable, machine-readable code for this field’s failure.

string
value
required

The rejected value. Always present, and null when it was not safe to echo back.

null | string
message
required

A human-readable explanation of what is wrong with the field.

string
overridable

Set only by the dispatcher application’s manual planning operations — integration endpoints never set it. True when every problem in this refusal is a tenant-policy refusal the operator may override by re-sending the same request with force: true. Omitted otherwise.

null | boolean
Examplegenerated
{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"errors": [
{
"field": "example",
"code": "example",
"value": "example",
"message": "example"
}
],
"overridable": true
}

Missing or invalid credentials

Authenticated, but the role or scope does not allow this

Not found

Media typeapplication/problem+json

RFC 9457 problem body returned on every failure. type carries a stable machine-readable error code (see docs/api/error-codes.yaml), title a short human summary, status the HTTP status, detail the specific message.

object
type
null | string
title
null | string
status
null | integer format: int32
detail
null | string
instance
null | string
Examplegenerated
{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example"
}

Conflict

Media typeapplication/problem+json

RFC 9457 problem body returned on every failure. type carries a stable machine-readable error code (see docs/api/error-codes.yaml), title a short human summary, status the HTTP status, detail the specific message.

object
type
null | string
title
null | string
status
null | integer format: int32
detail
null | string
instance
null | string
Examplegenerated
{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example"
}

Rate limit exceeded, or an Idempotency-Key request is still in flight; retry after the Retry-After header

Media typeapplication/problem+json

RFC 9457 problem body returned on every failure. type carries a stable machine-readable error code (see docs/api/error-codes.yaml), title a short human summary, status the HTTP status, detail the specific message.

object
type
null | string
title
null | string
status
null | integer format: int32
detail
null | string
instance
null | string
Examplegenerated
{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example"
}

Unexpected error

Media typeapplication/problem+json

RFC 9457 problem body returned on every failure. type carries a stable machine-readable error code (see docs/api/error-codes.yaml), title a short human summary, status the HTTP status, detail the specific message.

object
type
null | string
title
null | string
status
null | integer format: int32
detail
null | string
instance
null | string
Examplegenerated
{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example"
}