Skip to content

Update a job preset

Open .md

PUT/v1/api/store/{team_slug}/setting/job_preset/{hash_id}

v1Operation ID v1_public_job_preset_update_put

Changes a job preset. Send name, note or assigned_users to change them, and list only the service lines, tasks and files that change, each with an action:

  • create: a new line or task, with the same fields as when creating a preset, or a new file from an upload.
  • update: an existing line, task or file by id, with its fields.
  • delete: an existing line, task or file by id.

Lines and files you leave out stay as they are; an empty list changes nothing. A task update without assigned_users keeps its people.

Use PUT. PATCH runs no rules and saves nothing but a new updated_at.

Returns the updated preset. Jobs already made from it don't change.

Permission

Needs the Manage Settings permission. The team owner always has it.

Business rules

  • Everything is checked against your team before anything is saved, and the whole save is one transaction: one refusal saves nothing.
  • A new line, task or person, and any reference you change, must be live: a service, saved location and task preset that aren't deleted, and people who are active members of your team. An update line that keeps a deleted service, location or task preset, or a person who has left, still saves.
  • A service option the service doesn't have still saves, but the preset reads is_valid: false.
  • Top-level assigned_users sets the people on the job itself: sent, it replaces them ([] removes everyone); left out, they stay. On a task update line, assigned_users works the same way; a task create line without it has nobody.
  • Files: a create row attaches a file you uploaded with "Upload a file" and not yet attached anywhere; a mockup must be an image. update and delete rows act only on this preset's own files; one that is already gone is skipped.
  • update and delete line and task ids must be this preset's; another preset's line returns 404 and nothing is saved.

Side effects

  • A delete file row removes the file from the preset. Jobs made from the preset earlier keep their copy of it.
  • Team members who have YoPrint open see the change at once.

Path parameters

  • team_slugstringrequired

    Your team slug, shown as Team ID next to your API key in Profile.

    • Example your-team
  • hash_idstringrequired

    The job preset. Its hash id from an earlier answer; there is no unique key for it.

    • Example 8vxTyCrd1y1gdf

Request body

application/json, required.

  • assigned_usersarray of objects

    The people on the job itself. Sent, the list replaces them ([] removes everyone); left out, they stay. People you add must be active members of your team.

    Fields of each item (1)
    • idstringrequired

      A team member's id, from GET /v1/api/store/{team_slug}/setting/user.

  • mockuparray of objects

    Mockup images. A create row must be an image file.

    Fields of each item (6)
    • actionstringrequired

      create attaches a file you uploaded with "Upload a file" (POST /v1/api/store/{team_slug}/async_upload). update changes one of this preset's files; delete removes it.

      • One of: "create", "update", "delete"
    • idstringrequired

      For create, the upload's id. For update and delete, the file's id from the preset's mockup list.

    • job_servicestring | array

      The service line, or a list of them, this file belongs to: a line's id, or the tmpid- id of a line created in the same request. Ids that are not lines of this preset are ignored. When sent, it replaces the file's links; [] removes them.

    • namestring

      The file's display name. Left out, it keeps its name.

    • positioninteger

      For update: where the file sorts among the preset's mockups. A create row always goes last.

    • Whether the mockup shows on PDFs. Jobs made from the preset keep the setting.

  • namestring
  • notestring | null
  • pipelinearray of objects
    Fields of each item (7)
    • actionstringrequired

      What to do with this task.

      • One of: "create", "update", "delete"
    • assigned_usersarray of objects

      Who the task is assigned to. A create line without it has nobody. On an update line, leave it out to keep the task's people, or send the whole list to replace them ([] removes everyone). People you add must be active members of your team; people already on the task may stay after they leave.

      Fields of each item (1)
      • idstringrequired

        A team member's id, from GET /v1/api/store/{team_slug}/setting/user.

    • idstring

      The task to change, for update and delete.

    • namestring

      The task's name.

    • notestring | null
    • The task preset this task follows, from GET /v1/api/store/{team_slug}/setting/pipeline. Required unless action is delete. A new task, or one that changes it, needs a task preset that isn't deleted.

    • positioninteger
      • Minimum -2147483648
      • Maximum 2147483647
  • production_filearray of objects

    Production files, of any type.

    Fields of each item (6)
    • actionstringrequired

      create attaches a file you uploaded with "Upload a file" (POST /v1/api/store/{team_slug}/async_upload). update changes one of this preset's files; delete removes it.

      • One of: "create", "update", "delete"
    • idstringrequired

      For create, the upload's id. For update and delete, the file's id from the preset's production_file list.

    • job_servicestring | array

      The service line, or a list of them, this file belongs to: a line's id, or the tmpid- id of a line created in the same request. Ids that are not lines of this preset are ignored. When sent, it replaces the file's links; [] removes them.

    • namestring

      The file's display name. Left out, it keeps its name.

    • positioninteger

      For update: where the file sorts among the preset's production files. A create row always goes last.

    • Saved on the file and copied to jobs made from the preset.

  • servicearray of objects
    Fields of each item (8)
    • actionstringrequired

      What to do with this service line.

      • One of: "create", "update", "delete"
    • customer_notestring | null

      A note the customer sees. Jobs made from the preset get it on their service.

    • idstring

      For update and delete: the service line to change. On a create line you may send a temporary id that starts with tmpid- (such as tmpid-1), so a file row in the same request can name the new line in job_service.

    • locationobject

      Where the service goes on the product. Required unless action is delete.

      Child fields (3)
      • typestringrequired

        database: one of your saved service locations, by id (from GET /v1/api/store/{team_slug}/service_location). custom: a one-off location, by name.

        • One of: "database", "custom"
      • idstring

        Required when type is database. A new or changed location must not be deleted. Ignored for custom.

      • namestring

        Required when type is custom.

    • notestring | null

      A production note for this service.

    • optionstring

      One of the service's options (a column of its price table). Required unless action is delete. Any value saves, but one the service doesn't have marks the preset is_valid: false.

    • positioninteger

      Order of the service lines. Required unless action is delete.

      • Minimum -2147483648
      • Maximum 2147483647
    • The decoration service ID. Required unless action is delete. The service must be active (not deleted). Services are not listed directly on the public API; copy service_id from an existing job preset (List job presets) or from a job's services.

Response

200Successful response.

  • dataobjectrequired
    Child fields (12)
    • assigned_usersarray of objectsrequired

      The people on the job itself. Jobs made from the preset get the ones still on your team.

      Fields of each item (4)
      • avatar_urlstring | nullrequired

        Their profile picture, or null.

      • idstringrequired
      • namestringrequired
      • removedbooleanrequired

        True when the person was deleted or is no longer on your team. They stay listed until someone takes them off; jobs made from the preset leave them out.

    • idstringrequired
    • is_validbooleanrequired

      False when a service, saved location, or task preset it uses was deleted, or a service option no longer exists.

    • mockuparray of objectsrequired

      Mockup images, in their order.

      Fields of each item (19)
      • collectionstringrequired
        • One of: "mockup", "production_file"
      • created_atstring (date-time)required

        When the file record was made: the upload time, or for a duplicated preset, when it was copied.

      • custom_propertiesobject | arrayrequired
      • file_namestringrequired
      • idstringrequired

        The file's id: use it in update and delete file rows.

      • is_imagebooleanrequired
      • job_preset_idstringrequired

        The preset the file belongs to.

      • job_servicearray of stringsrequired

        The ids of this preset's service lines the file belongs to. A job made from the preset links its copy to the matching new services.

      • mime_typestring | nullrequired
      • namestring | nullrequired

        The display name.

      • positioninteger | nullrequired

        Where the file sorts, lowest first.

      • previewobject | nullrequired

        Preview image links small, medium and large (250, 800 and 1200 px), or null when there is no preview.

      • show_in_pdfboolean | nullrequired

        Null when it was never set.

      • sizeintegerrequired

        Bytes.

      • source_media_idnullrequired

        Always null on a preset's files.

      • urlstring | nullrequired

        Where to download the file.

      • view_urlstring | nullrequired

        A signed link to view the file. It expires: read it fresh, and don't store it.

      • dimensionsobject | null

        Pixel size of an image, read from its header; null for other files and for images uploaded before the size was recorded.

        Child fields (2)
      • ready: the preview links work. processing: an image over 10 MB whose stored preview a worker is still making (seconds); read the file again, or in the web app wait for media.preview_state_changed on the team channel. too_large: an image over 120 megapixels; it never gets a preview. failed: the worker gave up. none: not an image.

        • One of: "ready", "processing", "too_large", "failed", "none"
    • namestringrequired
    • needs_reviewbooleanrequired

      True when the preset needs review (shown as "Needs review" in the web app):

      • is_valid is false (a service, service option, saved location, or task preset was deleted)
      • A team member assigned to one of its tasks was deleted or left the team (assignees on the job itself do not trigger review)

      A preset that needs review still saves. Creating a job from it omits missing tasks and removed teammates.

    • notestring | nullrequired
    • pipelinearray of objectsrequired

      The tasks.

      Fields of each item (11)
      • assigned_usersarray of objects
      • idstring
      • is_validboolean
      • namestring | null
      • notestring | null
      • pipelineobject | null

        The task preset it follows, as GET /v1/api/store/{team_slug}/setting/pipeline/{hash_id} returns it: id, label, color, version, enable, trashed, and its statuses (deleted ones included).

        Child fields (7)
        • colorstring
        • enableboolean
        • idstring
        • labelstring
        • statusesarray of objects
          Fields of each item (9)
          • colorstringrequired
          • customer_labelstringrequired

            What customers see in the customer portal. When none is set: Pending for start, In Progress for in_progress and pre_production, Completed for end.

          • idstringrequired
          • labelstringrequired
          • positionintegerrequired

            Sort order within the list, lowest first.

          • rolestringrequired

            Which list the status belongs to:

            • order: sales orders
            • quote: quotes
            • job: jobs
            • purchase_order: purchase orders
            • shipment: shipments
            • customer_message: message threads
            • pipeline: tasks within a task preset
            • One of: "order", "quote", "job", "purchase_order", "shipment", "customer_message", "pipeline"
          • trashedbooleanrequired

            True for a deleted status. Only the full list includes deleted ones.

          • typestringrequired

            The stage of the status in the workflow: start (first status in the list), pre_production, in_progress, or end (final status).

            • One of: "start", "pre_production", "in_progress", "end"
          • The task preset, for pipeline statuses only. Absent for every other role.

        • trashedboolean
        • versioninteger
      • pipeline_colorstring | null

        The task preset's color.

      • pipeline_namestring | null

        The task preset's name.

      • positioninteger

        0 when none was sent.

      • trashedboolean

        True when its task preset was deleted.

    • positionstringrequired

      Sort order within the preset list, lowest first. A decimal string, such as "1.0000000000000000"; parse it as a decimal.

    • production_filearray of objectsrequired

      Production files, in their order.

    • servicearray of objectsrequired

      The service lines.

      Fields of each item (11)
      • versioninteger
        • Always 1
      • customer_notestring | null
      • idstring
      • locationobject

        type, display_name and trashed (true when a saved location was deleted), plus id for a saved location or name for a custom one.

      • notestring | null
      • optionstring | null
      • positioninteger
      • review_reasonstring | null

        Why the line needs review: its service was deleted, the service no longer has this option, or its saved location was deleted. Null when the line is fine.

        • One of: "service_removed", "option_removed", "location_removed"
      • service_namestring | null
      • validboolean

        False when review_reason is set.

    • updated_atstring (date-time) | nullrequired

      When the preset was last edited ("Last edited" in the web app). Every save changes it, even one that changes only its lines; reordering presets doesn't.

  • statusintegerrequired
  • successbooleanrequired

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, with unauthorized or user_is_not_authorized.

    When
    Your role lacks Manage Settings. The body is {"message": "Insufficient Permission"}, without the error envelope.
    Fix
    Use the key of a member whose role has Manage Settings, or the owner's.
  • 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.

    When
    The preset, or a line or task named by id, is not found in this preset.
    Fix
    Read the preset first and use its line ids.
    When
    A create file row names no upload of your team, or an update or delete file row names a file that isn't this preset's. error.code is null.
    Fix
    Use the upload's id, or a file id from the preset.
  • 422The request was refused and changed nothing. validation_failed lists what to fix in error.fields; other codes name a business rule, explained in error.message. A few checks answer with only {"message": "..."}. An operation that calls another service (a payment provider, a carrier, an accounting app) can answer connect_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
    name is missing (create), a line or file row has no action, a file row has no id, or a service line misses service_id, option, location.type or position (validation_failed).
    Fix
    Send every required field; see the schema.
    When
    A service, location, task preset or person is not your team's, or is deleted where a live one is needed; or a file row names a file that isn't a free upload, or a mockup that isn't an image. error.code job_validation_error, with a message such as "Service not found!", "Assigned User not found!", "Please upload this file before adding it to a job preset." or "Mockups must be image files."
    Fix
    Use ids from your own team's lists, and upload files first.