Add a job to a sales order or quote
AI agents: read /llms.txt; add .md to any page URL. This page as Markdown: /reference/jobs/v2-job-store.md. Index of every page and the rules for every call: /llms.txt. Guides and concepts in one file: /llms-full.txt. OpenAPI: /openapi.json.
POST/
Adds a job to a sales order or quote. Add the job first, then add line items linked to it (job: {"type": "linked", "id": ...}): every line on the job takes its decoration price.
A job can carry, all optional:
service: decoration services from Settings, each at a print location with one of the service's price options (services are not listed on the public API: copyservice_idandoptionfrom an existing job or job preset);pipeline: work pipelines (production steps), each with a starting status;mockupandproduction_file: files you uploaded first, shown on the job.
Each service, pipeline and mockup entry needs action: "create", or it is skipped silently; a production_file entry without action is refused with 422. To tie a mockup to a service, give the service a temporary id of your own (for example tmpid-1) and use it in the mockup's job_service.
The job gets the team's next job number and the order's production dates. The answer is the job.
Works on drafts and published orders. In any other state the call answers HTTP 200 with {"status": 500, "success": false, "error": {"code": "action_not_allowed", "message": null}} and changes nothing: check success, not only the HTTP status. {hash_id} is the order's id (for example V4keXwwxMQyXw7); the ord_ unique key is not accepted here.
Business rules
- Each
service,pipelineandmockupentry needsaction: "create", or it is skipped silently. Aproduction_fileentry withoutactionis refused with 422validation_failed. - A service must exist in the team's Settings ("Service Not Found") and
optionmust be one of its options ("Service does not contain such option ..."). - A pipeline needs
pipeline_idandstatus_id; itsstart_dateanddue_datego together. scoped_idis ignored: jobs always take the team's next job number.
Side effects
- Recalculates the decoration pricing of the order's jobs and the order totals.
- Refreshes the order for people who have it open in the web app. On a published order, Customer Portal pages the customer has open refresh.
Path parameters
Your team slug, shown as Team ID next to your API key in Profile.
- Example
your-team
- Example
The sales order's or quote's
id(a hash id). Theord_unique key and the order number do not work here.- Example
V4keXwwxMQyXw7
- Example
Request body
application/json, required.
draft_session_idstringUsed by the web app's mockup designer. Leave it out.
draft_session_mockuparray of objectsUsed by the web app's mockup designer. Leave it out.
has_servicebooleanIgnored; kept for older clients.
is_rushbooleanmockuparray of objectsMockup images, uploaded first.
Fields of each item (6)
Send
createon every entry: a service, pipeline or mockup without it is skipped silently; a production file without it is refused.- One of:
"create"
- One of:
The upload's
id.Show it on the order PDF.
job_serviceanyThe temporary service
id(or ids) this mockup belongs to.namestring
namestring | nullThe job's name, for example "Front logo".
notestringAn internal note.
pipelinearray of objectsWork pipelines (production steps).
Fields of each item (8)
Send
createon every entry: a service, pipeline or mockup without it is skipped silently; a production file without it is refused.- One of:
"create"
- One of:
A work pipeline id from Settings.
The pipeline's starting status id.
A user id, or a list of user ids, to assign.
due_datestring (date-time) | nullDue date (ISO 8601 date or date-time), or null. Send together with
start_date.namestringpositionintegerstart_datestring (date-time) | nullStart date (ISO 8601 date or date-time), or null. Send together with
due_date.
positionintegerWhere the job sits among the order's jobs. Leave it out to add it last.
production_filearray of objectsProduction files, uploaded first.
Fields of each item (5)
Send
createon every entry: a service, pipeline or mockup without it is skipped silently; a production file without it is refused.- One of:
"create"
- One of:
The upload's
id.job_serviceanyThe temporary service
id(or ids) this file belongs to.namestring
scoped_idstringAccepted but ignored: the job gets the team's next job number. To change it afterwards, use Change a job number.
servicearray of objectsDecoration services.
Fields of each item (8)
Send
createon every entry: a service, pipeline or mockup without it is skipped silently; a production file without it is refused.- One of:
"create"
- One of:
A decoration service id. Services are not listed on the public API: copy
service_idfrom a job'sservices(Get one job of an order) or from a job preset (List job presets).customer_notestringA note the customer sees.
idstringYour temporary id for this service, to reference it from mockups.
locationobjectnotestringoptionstringOne of the service's price option names, exactly as the service has it (the match is exact, case included), such as
2 Color. Copy it fromservices[].optionon an existing job or job preset. Another name, or none, is refused with 422job_validation_error"Service does not contain such option …".positionintegerOrder among the job's services. Required with
id.
More examples (1)
A job with a name only
curl -X POST 'https://secure.yoprint.com/v2/api/store/your-team/v2/sales_order/V4keXwwxMQyXw7/job' \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Accept: application/json' \ -H 'X-Yoprint-Decimal-Format: exact-v1' \ -H 'Content-Type: application/json' \ -d '{ "name": "Team shirts" }'Response
200Successful response.
Errors
401The API key is missing or wrong (
unauthenticated).403You are not allowed to do this.
api_access_not_in_plan: your team's plan doesn't include API access (Pro and above, with an active subscription or trial), so every request answers this until the team upgrades. When your role lacks the permission the operation needs, the body is only{"message": "Insufficient Permission"}. Other refusals use the error envelope, withunauthorizedoruser_is_not_authorized.- When
- The API key's role can't edit this order.
- Fix
- Ask the team owner for sales order edit permission.
404Not found.
page_not_found: the team slug is unknown, you are not a member of the team, or an id in the path is not one of this team's.code: null, with a message that starts "No query results for": there is no record with that id.422The request was refused and changed nothing.
validation_failedlists what to fix inerror.fields; other codes name a business rule, explained inerror.message. A few checks answer with only{"message": "..."}. An operation that calls another service (a payment provider, a carrier, an accounting app) can answerconnect_timeout("Please retry again") when that service does not answer in time: the change may or may not have happened there, so read the record back before you retry.- When
optionis not one of the service's option names, exactly:job_validation_error"Service does not contain such option …" (the name you sent).- Fix
- Copy the option name from
services[].optionon an existing job or job preset that uses the service. - When
- The service is not one of the team's ("Service Not Found:…"), or a required field is missing (
job_validation_error). - Fix
- Copy
service_idfrom an existing job or job preset.
Related
- POSTAdd a job from a job template
/v2/ api/ store/ {team_slug}/ v2/ sales_order/ {hash_id}/ job_template - POSTAdd a line item to a sales order or quote
/v2/ api/ store/ {team_slug}/ v2/ sales_order/ {order_unique_key}/ order_item - PUTUpdate a job
/v2/ api/ store/ {team_slug}/ v2/ job/ {hash_id} - POSTUpload a file
/v1/ api/ store/ {team_slug}/ async_upload - GETGet one job of an order
/v2/ api/ store/ {team_slug}/ v2/ sales_order/ {hash_id}/ job/ {job_id} - GETList job presets
/v1/ api/ store/ {team_slug}/ setting/ job_preset
