POST
/
v1
/
order_batches
curl --request POST \
  --url https://api.ongoody.com/v1/order_batches \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "from_name": "John",
  "message": "Thank you!",
  "send_method": "link_multiple_custom_list",
  "payment_method_id": null,
  "workspace_id": null,
  "card_id": "8eeace2d-a21c-4036-aba6-8f3fb39beceb",
  "recipients": [
    {
      "first_name": "Alena",
      "last_name": "Kenter",
      "email": "alena@ongoody.com"
    },
    {
      "first_name": "Michael",
      "last_name": "Franci",
      "email": "michael@ongoody.com"
    }
  ],
  "cart": {
    "items": [
      {
        "product_id": "7388be95-6ad1-4da3-9a31-f800af8dfe59",
        "quantity": 1
      }
    ]
  }
}'
{
  "id": "a02cdb7f-6ae7-4d9f-8c65-adcaa4354f9a",
  "send_status": "complete",
  "from_name": "John",
  "message": "Thank you!",
  "orders_count": 2,
  "orders_preview": [
    {
      "id": "94e12391-cbde-4d1d-8b73-d03a65587d2c",
      "status": "created",
      "individual_gift_link": "https://gifts.ongoody.com/gift/jWd9HDaDuGIYGpbhY5e2PlwD",
      "recipient_first_name": "Alena",
      "recipient_last_name": "Kenter",
      "recipient_email": "alena@ongoody.com",
      "card_id": "8eeace2d-a21c-4036-aba6-8f3fb39beceb",
      "message": "Thank you!",
      "thank_you_note": null,
      "view_count_recipient": 0,
      "is_swapped": false,
      "order_batch_id": "a02cdb7f-6ae7-4d9f-8c65-adcaa4354f9a",
      "expires_at": null,
      "cart": {
        "id": "b54b58e5-b802-4de7-8723-59d4b35e2970",
        "items": [
          {
            "id": "6122d461-f1cc-4e3d-82cb-469c4f220308",
            "quantity": 1,
            "product": {
              "id": "7388be95-6ad1-4da3-9a31-f800af8dfe59",
              "name": "Cookies",
              "brand": {
                "id": "bc11d902-5a0d-4b1d-8562-87067d981919",
                "name": "Cookie Company"
              }
            }
          }
        ]
      },
      "shipments": [],
      "amounts": {
        "amount_product": 1000,
        "amount_shipping": 1000,
        "amount_processing_fee": 100,
        "amount_pre_tax_total": 2100,
        "amount_tax": null,
        "amount_total": null,
        "amount_global_relay_cost": null
      },
      "sender": {
        "first_name": "Test",
        "last_name": "User",
        "email": "15553655881@test.ongoody.com"
      },
      "workspace_id": "03b82d42-f1e8-4ab3-b5a1-126137ecaa7d",
      "workspace_name": "Test Team",
      "original_cart": null,
      "original_amounts": null,
      "reference_id": "SDSW1CB3S4B1LNJFI8H7FWVF",
      "payment_link": null
    },
    {
      "id": "64ab93d0-00a4-4526-b348-9d3a787ea4d3",
      "status": "created",
      "individual_gift_link": "https://gifts.ongoody.com/gift/xD5LRuotKdtJ0em1FaTEbaeT",
      "recipient_first_name": "Michael",
      "recipient_last_name": "Franci",
      "recipient_email": "michael@ongoody.com",
      "card_id": "8eeace2d-a21c-4036-aba6-8f3fb39beceb",
      "message": "Thank you!",
      "thank_you_note": null,
      "view_count_recipient": 0,
      "is_swapped": false,
      "order_batch_id": "a02cdb7f-6ae7-4d9f-8c65-adcaa4354f9a",
      "expires_at": null,
      "cart": {
        "id": "b54b58e5-b802-4de7-8723-59d4b35e2970",
        "items": [
          {
            "id": "6122d461-f1cc-4e3d-82cb-469c4f220308",
            "quantity": 1,
            "product": {
              "id": "7388be95-6ad1-4da3-9a31-f800af8dfe59",
              "name": "Cookies",
              "brand": {
                "id": "bc11d902-5a0d-4b1d-8562-87067d981919",
                "name": "Cookie Company"
              }
            }
          }
        ]
      },
      "shipments": [],
      "amounts": {
        "amount_product": 1000,
        "amount_shipping": 1000,
        "amount_processing_fee": 100,
        "amount_pre_tax_total": 2100,
        "amount_tax": null,
        "amount_total": null,
        "amount_global_relay_cost": null
      },
      "sender": {
        "first_name": "Test",
        "last_name": "User",
        "email": "15553655881@test.ongoody.com"
      },
      "workspace_id": "03b82d42-f1e8-4ab3-b5a1-126137ecaa7d",
      "workspace_name": "Test Team",
      "original_cart": null,
      "original_amounts": null,
      "reference_id": "EPRN0FET0FYGF9YZGSD9WMDB",
      "payment_link": null
    }
  ],
  "recipients_count": 2,
  "recipients_preview": [
    {
      "first_name": "Alena",
      "last_name": "Kenter",
      "email": "alena@ongoody.com"
    },
    {
      "first_name": "Michael",
      "last_name": "Franci",
      "email": "michael@ongoody.com"
    }
  ],
  "cart": {
    "id": "b54b58e5-b802-4de7-8723-59d4b35e2970",
    "items": [
      {
        "id": "6122d461-f1cc-4e3d-82cb-469c4f220308",
        "quantity": 1,
        "product": {
          "id": "7388be95-6ad1-4da3-9a31-f800af8dfe59",
          "name": "Cookies",
          "brand": {
            "id": "bc11d902-5a0d-4b1d-8562-87067d981919",
            "name": "Cookie Company"
          }
        }
      }
    ]
  },
  "is_scheduled_send": false,
  "scheduled_send_on": null,
  "expires_at": null,
  "send_method": "link_multiple_custom_list",
  "batch_name": "Alena Kenter and Michael Franci",
  "card_id": "8eeace2d-a21c-4036-aba6-8f3fb39beceb",
  "sender": {
    "first_name": "Test",
    "last_name": "User",
    "email": "15553655881@test.ongoody.com"
  },
  "workspace_id": "03b82d42-f1e8-4ab3-b5a1-126137ecaa7d",
  "workspace_name": "Test Team",
  "reference_id": "JEJ9H8ALVENCIRTAYZLOUFSJ"
}

For a guide on how to create an order batch, see the Getting Started guide for the Automation API Getting Started guide or the Commerce API Getting Started guide.

Order batches with 10 or fewer recipients

Order batches with 10 or fewer recipients are created synchronously, and the returned status field will be completed. The orders and order links are available immediately inside the orders_preview field (which returns the first 10 orders).

Order batches with more than 10 recipients

Order batches with more than 10 recipients are created asynchronously, and the order batch will have a status of pending. The orders and gift links won’t be available until the order batch is finished processing synchronously. You can check the status of the order batch by calling the /order_batches/:id endpoint, or by receiving a webhook notification on the order_batch.completed event.

Once an order batch is created, you can access all of the orders by calling the /order_batches/:id/orders endpoint, where you can paginate through the list of orders. If your use case always sends 10 or fewer orders at a time, you can just use the orders_preview field on the order batch which gives you the first 10 orders.

Authorizations

Authorization
string
headerrequired

Your Goody API key.

Body

application/json

Input parameters for an order batch.

from_name
string
required

The name of the sender of the order (typically a gift), to be displayed as "from".

recipients
object[]
required
cart
object
required
send_method
enum<string>
required

The method for sending a order batch. email_and_link sends a gift email to the recipient (specify email for each recipient). link_multiple_custom_list generates a gift link without an automatic email. direct_send ships the product directly to the recipient (specify mailing_address for each recipient). For more information, see Send Methods.

Available options:
email_and_link,
link_multiple_custom_list,
direct_send
message
string

For gifts, a message for the gift to be displayed in the digital unwrapping and email notifications, if enabled.

card_id
string

The digital greeting card to attach to gifts. A card must be specified if a message is specified, since the message is displayed after the card is opened.

payment_method_id
string

The payment method used to pay for this order batch. If not specified, defaults to the first payment method on the account. If the account has no payment methods, then the order batch creation will fail.

workspace_id
string

Workspace to create the order batch in. If not specified, creates the order batch in the oldest workspace the user has access to.

scheduled_send_on
string | null

The date and time at which the order batch will be sent. If not specified, the order batch is sent immediately. If an order batch is scheduled to be sent in the future, then orders will not be created until the scheduled send time. ISO 8601 format.

expires_at
string | null

The date and time at which the order batch will expire. If not specified, the order batch does not expire. An expiry must be set for orders paid using account balance. ISO 8601 format.

swap
enum<string>

What method to use to allow recipients to swap their gift. single (default) allows the recipient to swap the gift for one item, with hidden gift prices. multiple allows them to swap for multiple items up to the gift cost, with gift prices shown. disabled disables swapping on the gift. For gift collections (gift of choice), this must not be disabled.

Available options:
single,
multiple,
disabled
international_shipping_tier
enum<string>

Whether to enable international shipping on this order. disabled (default) only enables US shipping on this order. standard combined with international_gift_cards_enabled enables international gift cards. full enables the full global catalog for 100+ countries, with additional tax, duties, and freight costs.

Available options:
disabled,
standard,
full
international_gift_cards_enabled
boolean

Whether to enable international gift cards on this order. If true and the international_shipping_tier is standard, then international gift cards can be swapped to. If false, then international gift cards are not available to be swapped to.

reserved_options
object | null

For approved API partners only.

Response

201 - application/json

An order batch is the primary resource created by the API. Order batches contain an array of orders.

id
string
required
send_status
enum<string>
required

The pending status indicates that an order batch is being prepared to be sent out. If it is not scheduled, it is being sent asynchronously. If it is scheduled, it will stay in pending state until the scheduled time is reached, at which point it will be processed and moved to complete. When it is in pending status, no orders are created yet. When the order batch is in complete status, all orders are created and available.

Available options:
pending,
complete,
failed,
canceled
from_name
string
required

The name of the sender. This is displayed on the order and notifications.

orders_count
integer
required

The total number of orders in this order batch. This might be blank if the order batch is scheduled for the future, or it could be fewer than the recipient count if the order batch is in the process of being sent.

orders_preview
object[]
required

A preview of the first 10 orders in this order batch. To paginate through all of the orders, use the /order_batches/:id/orders endpoint with ?page&per_page. If your use case never sends more than 10 orders in a single batch, you can use this field instead of calling /order_batches/:id/orders. For order batches with more than 10 recipients, this array will be empty while the orders are asynchronously created in the background.

recipients_count
integer
required

The total number of recipients in this order batch.

recipients_preview
object[]
required

A preview of the first 10 recipients in this order batch. To see all of the recipients, use /order_batches/:id/recipients. Recipients contain the original contact information provided for each recipient when the order batch was created.

cart
object
required

The cart that was sent for this order batch. This is the original cart that was created for this order batch. If individual orders were swapped, this still remains the same, whereas orders' cart would change if they were swapped.

sender
object
required

The sender of the order batch.

reference_id
string
required

The reference ID displayed on receipts and other locations as the ID for this order batch.

message
string | null

The message in this order batch, provided by the sender.

is_scheduled_send
boolean

Whether this order batch was set up as a scheduled send. This stays as true after the scheduled send is complete. To determine if the order batch is scheduled to be sent for the future, check if status is pending and scheduled_send_on is in the future. When a order batch is scheduled, orders are only created on the scheduled send date.

scheduled_send_on
string | null

The date and time the order batch is scheduled to be sent. This will be null if the order batch is not a scheduled send. This field remains after the scheduled send completes. ISO 8601, UTC.

expires_at
string | null

The date and time the order batch is set to expire. ISO 8601, UTC.

send_method
enum<string>

The method for sending a order batch. email_and_link sends a gift email to the recipient (specify email for each recipient). link_multiple_custom_list generates a gift link without an automatic email. direct_send ships the product directly to the recipient (specify mailing_address for each recipient). For more information, see Send Methods.

Available options:
email_and_link,
link_multiple_custom_list,
direct_send
batch_name
string | null

An internal name for the order batch, falling back to an auto-generated batch name. Not displayed to recipients.

card_id
string | null

The digital greeting card on this order batch.

workspace_id
string | null

Organizations are sub-divided into workspaces. Order batches are contained in workspaces, identified by this ID.

workspace_name
string | null