Skip to content

Decode a YoPrint barcode

Open .md

POST/v1/api/store/{team_slug}/decode_barcode

v1Operation ID v1_public_misc_decode_barcode

Turns the text of a barcode or QR code printed by YoPrint on a work order, packing slip, label or purchase order into the record it points to: its type and id. Use it in a scanner app.

YoPrint codes look like y9-0p-<kind>-<number>, where kind is ord (sales order or quote), po (purchase order), ship (shipment), job (job) or ta (stock transfer). For a job or shipment, parent is its order.

Permission

Any member of the team. It does not check whether you can view the record.

Business rules

  • value is required and must start with y9-0p-.

Path parameters

  • team_slugstringrequired

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

    • Example your-team

Request body

application/json, required.

  • valuestringrequired

    The scanned text, starting with y9-0p-.

    • Matches ^y9-0p-

Response

200Successful response.

  • dataobjectrequired
    Child fields (4)
    • idstringrequired

      The record's id.

    • typestringrequired
      • One of: "sales_order", "quote", "purchase_order", "shipment", "job", "transfer_adjustment"
    • Quotes only: quote.

    • parentobject

      Jobs and shipments: the order they belong to.

      Child fields (3)
  • 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.

  • 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 kind is unknown, or the record does not exist on this team or was deleted. The error has no code or message.
    Fix
    Check you are using the right team. A deleted record can't be scanned.
  • 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
    value is missing or does not start with y9-0p- (validation_failed; error.fields names the field).
    Fix
    Send the scanned text exactly as read. It is not a YoPrint code otherwise.

Notes

  • The number in the code is not the id the API uses. Always decode it here instead of building ids yourself.