Create Production Run from Sales Order

Beta
POST/v1/sales/sales-orders/{id}/actions/create-production-run

Idempotent with Idempotency-Key header. Learn more

Creates a production run from a sales order.

Walks the production flow behind each item-backed line to work out what actually has to be made, then creates one batch for each item that is produced directly from raw materials, sized to cover every line that needs it. Reserves the material inventory those batches consume and links the run to the order. The caller becomes the run's responsible user. An order can have at most one production run, and a line whose item has no production flow contributes no batches.

Permissions requiredValues:production_runs:create
The role behind your API key or agent must grant every one of these permissions.
idstring

Sales order ID.

include[]optional arrayenumValues:responsible_userresponsible_user.user

Sub-objects to expand in the response. When omitted, sub-objects are returned as null.

idstring

Production run ID.

objectstringenumValues:production_run

Resource type identifier.

numberstring

Production run number, unique per account.

Assigned automatically at creation as the next sequential number for the account; can be changed via update.

responsible_useraccount_userExpandablenullable

Account user accountable for executing the run.

idstring

Account user ID.

objectstringenumValues:account_user

Resource type identifier.

statusstringenumValues:activedisabledremoved

The current state of this user's membership in the account.

  • active: the user can sign in to the account and occupies one of the plan's seats.
  • disabled: the user is locked out of the account and their sessions have been revoked, but the membership is retained.
  • removed: the membership has been soft-deleted; it is hidden from listings by default and can be restored with the activate action.
rolerolenullable

The role that determines what this user is permitted to do in the account.

Always returned as null in this endpoint.
departmentdepartmentnullable

The department this user belongs to within the account.

Always returned as null in this endpoint.
useruserExpandablenullable

The underlying user profile, shared across every account this person belongs to.

idstring

User ID.

objectstringenumValues:user

Resource type identifier.

emailstringnullable

Email address the user signs in with and receives platform email at.

namestringnullable

User's full display name.

usernamestringnullable

Username the user can sign in with instead of their email address.

Usernames are unique across the whole platform, not just within your account.

email_verified_atstring (date-time)nullable

When the user verified their email address.

image_urlstringnullable

Location of the user's profile image.

For photos uploaded through the API this holds an internal path rather than a fetchable image URL; call Get User Photo URL to obtain a temporary link to the image itself.

created_atstring (date-time)

Creation timestamp.

updated_atstring (date-time)

Last updated timestamp.

is_commission_eligibleboolean

Whether this user can be assigned as a sales representative on orders, territories, and targets.

Independent of the sales_rep role type, which still scopes analytics and hides cost. Users with the sales_rep role are always eligible.

last_used_atstring (date-time)nullable

When the user last accessed this account.

created_atstring (date-time)

When the account user was created.

updated_atstring (date-time)

When the account user was last updated.

batch_countinteger

Number of batches currently recorded against this run.

started_atstring (date-time)nullable

Time the run started production.

Set automatically the first time a batch in the run is scanned at a station.

completed_atstring (date-time)nullable

Time the run finished production.

Set automatically once every batch in the run has been scanned or deleted. From that point the run can no longer be updated and no further batches can be added to it.

created_atstring (date-time)

Creation timestamp.

updated_atstring (date-time)

Last-updated timestamp.

Responses

201

Successful response for Create Production Run from Sales Order