Orders

Create or update orders

POST/orders

The body is a JSON list of up to 25 orders, keyed by external_id (source api; a connected store's orders are never touched). Always 200 with one result per order: one invalid order never fails the others. An order is attached to profile_id if that profile is in the account, otherwise to the profile with the same email; with neither it is stored unlinked and attached when such a profile appears. Orders never create profiles. Order events (placed_order, ordered_product per line, fulfilled_order, cancelled_order, refunded_order) are recorded by YouSendIt from the order, and corrected when the order changes; they are not counted against the event allowance. Parts of an order that happened more than 48 hours before it was FIRST submitted are stored as historical (they never trigger flows or webhooks). Which copy wins: a copy replaces the stored order unless it is older by updated_at. A copy WITHOUT updated_at replaces a stored copy that also has none (last write wins) and NEVER replaces one that has it: such a copy is reported as stale. Send updated_at always, or never.

Permission: orders:write · on the API key screen: Orders → Full access · All permissions

Body parameters

  • external_idstringrequired

    Your id for the order. The upsert key.

    At least 1 characters. At most 255 characters.

  • namestring | null

    At most 100 characters.

  • profile_idstring

    The buyer, if you know the profile id. Otherwise the order is matched by email.

    At most 2,000 characters.

  • emailstring | null

    At most 254 characters.

  • currencystring

    At most 2,000 characters.

  • totalstring | numberrequired
  • subtotalstring | number | null
  • taxstring | number | null
  • discountsstring | number | null
  • shippingstring | number | null
  • financial_statusstring | null

    At most 30 characters.

  • fulfillment_statusstring | null

    At most 30 characters.

  • placed_atstringrequired

    At most 2,000 characters.

  • cancelled_atstring | null

    At most 2,000 characters.

  • fulfilled_atstring | null

    At most 2,000 characters.

  • updated_atstring

    When the order last changed in your system. See 'Which copy wins' in docs/API.md.

    At most 2,000 characters.

  • refundsobject[]

    At most 50 items.

    Show properties
    • idstringrequired

      At least 1 characters. At most 100 characters.

    • amountstring | numberrequired
    • atstring

      At most 2,000 characters.

  • itemsobject[]

    The COMPLETE line list: lines not in it are removed. Omit to leave lines alone.

    At most 100 items.

    Show properties
    • external_idstringrequired

      Your id for the line (stable across updates).

      At least 1 characters. At most 255 characters.

    • product_external_idstring | null

      At most 255 characters.

    • variant_external_idstring | null

      At most 255 characters.

    • titlestring | null

      At most 500 characters.

    • variant_titlestring | null

      At most 500 characters.

    • skustring | null

      At most 255 characters.

    • quantitynumber

      From 0 to 1000000.

    • pricestring | number

      Unit price.

Response

  • writtennumberrequired
  • stalenumberrequired
  • failednumberrequired
  • resultsobject[]required

    At most 25 items.

    Show properties
    • indexnumberrequired
    • statusstringrequired

      One of: created updated stale failed

      At most 2,000 characters.

    • idstring | nullrequired

      At most 2,000 characters.

    • profile_idstring | nullrequired

      At most 2,000 characters.

    • codestring | nullrequired

      At most 64 characters.

    • paramstring | nullrequired

      At most 300 characters.

    • messagestring | nullrequired

      At most 500 characters.