# Retrieve orders

Retrieves a list of orders.

Endpoint: GET /subscriptions
Version: latest
Security: SecretApiKey, JWT, ApplicationJWT

## Query parameters

- `filter` (string)
  Criteria for filtering collection items. This field requires a special format. Use `,` to specify multiple allowed values. Use `;` to specify multiple fields. For more information, see [Search filters](https://www.rebilly.com/docs/dev-docs/search-filters).
- `sort` (array)
  Sorts and orders the collection of items. To sort in descending order, prefix with `-`. Multiple fields can be sorted by separating each with `,`.
- `limit` (integer)
  Limit the number of subscriptions to return. Use `0` to return an empty collection and still receive the count of matching items in `Pagination-Total`. When `expand` includes `initialInvoice` or `recentInvoice`, cap values greater than `100` at `100`.
- `offset` (integer)
  Specifies the starting point within the collection of items to be returned.
- `q` (string)
  Use this field to perform a partial search of text fields.
- `expand` (string)
  Expand a response to receive a full related object in the `_embedded` path. To expand multiple objects, use a comma-separated list. Example: `expand=recentInvoice,initialInvoice`. Available arguments are: - `customer` - `leadSource` - `website` - `shippingRate` - `initialInvoice` - `recentInvoice` - `upcomingInvoice` - `paymentInstrument` For more information, see [Embedded resources](https://www.rebilly.com/docs/dev-docs/expand-embedded-resources).

## Response 200 fields

- `id` (string)
  ID of the order.
  Example: sub_01HRF27SATGE4Z6PBJE6PD8328
- `orderType` (string, required)
  Specifies the type of order. An order may be a subscription or a one-time purchase. > **Note:** The order type cannot be changed after creation.
  Enum: "subscription-order"
- `customerId` (string, required)
  ID of the customer resource.
  Example: cus_0YV7DDSDD1C8DA64KHH2W33CPF
- `renewalReminderTime` (string | null)
  Date and time when the renewal reminder event triggers.
- `renewalReminderNumber` (integer | null)
  Number of triggered renewal reminder events.
- `abandonReminderTime` (string | null)
  Date and time when the abandon order reminder event triggers.
- `abandonReminderNumber` (integer | null)
  Number of abandon order reminder events that are triggered.
- `organizationId` (string)
  Unique organization identifier. An organization is an entity that represents a company. For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
  Example: org_0YVDM8RC7GDADADSBSMW124JA8
- `status` (string)
  Status of the subscription service. A subscription starts in the `pending` status, and becomes `active` when the service period begins.
  Enum: "pending", "active", "abandoned", "canceled", "churned", "paused", "voided", "completed", "trial-ended"
- `inTrial` (boolean)
  Specifies if the subscription is currently in a trial period.
- `trial` (object)
  Details of the trial. To use plan defaults, omit the `trial` key or set this value to `null`.
- `trial.enabled` (boolean)
  Specifies if there is a trial for this subscription. Plans without trial prices are free trials.
- `trial.endTime` (string | null)
  Time and date when the trial ends. If the order churns during the trial, this value is the time when the order churned. If a trial is enabled on this subscription, a value must be provided. If the specified trial end time is in the past, the current time is used.
- `isTrialOnly` (boolean)
  Specifies if a subscription ends after a trial period. If this value is `true`, recurring settings are ignored.
- `trialConversionTime` (string | null)
  Date and time when the subscription had a trial conversion. Trial conversion occurs when the first successful payment is made after a trial period.
- `invoiceTimeShift` (object | null)
  Use invoice time shift to control the billing time. Invoice time shift adjusts the invoice issue and due date when billing must occur before the service period changes. Use invoice time shift in conjunction with `billingTiming` to: - Bill immediately when the service period starts. - Bill immediately after the service period ends. - Bill at an interval of time before the service period starts. - Bill at an interval of time after the service period starts. - Bill at an interval of time before the service period ends. - Bill at an interval of time after the service period ends.
- `invoiceTimeShift.issueTimeShift` (object)
  Calculation instruction of the billing time. This is used in conjunction with the service period anchor to calculate the time at which the invoice is issued. For more information, see [Service period anchor, billing timing, and invoice time shift](https://www.rebilly.com/docs/dev-docs/subscriptions#service-period-anchor-billing-timing-and-invoice-time-shift).
- `invoiceTimeShift.issueTimeShift.chronology` (string, required)
  Sequential order of the billing time relative to the start of the service period.
  Enum: "before"
- `invoiceTimeShift.issueTimeShift.duration` (integer, required)
  Amount of time by which to move the invoice issue time or date.
- `invoiceTimeShift.issueTimeShift.unit` (any, required)
  Unit of time.
- `invoiceTimeShift.dueTimeShift` (object)
  Calculation instruction of the invoice due time. This is used in conjunction with the service period anchor to calculate when an invoice is due for payment. For more information, see [Service period anchor, billing timing, and invoice time shift](https://www.rebilly.com/docs/dev-docs/subscriptions#service-period-anchor-billing-timing-and-invoice-time-shift). The sequential order of due time shift is always after the due date.
- `invoiceTimeShift.dueTimeShift.duration` (integer, required)
  Amount of time by which to move the invoice due time or date.
- `invoiceTimeShift.dueTimeShift.unit` (any, required)
  Unit of time.
- `autopay` (boolean)
  Specifies if payment attempts are made automatically. If autopay is enabled, the payment is retrieved from the customer on the renewal date using the payment instrument that is set at `paymentInstrumentId`, or the default payment instrument on the subscription.
- `startTime` (string | null)
  Date and time when the subscription starts. If this value is `null`, the current time is used. This value cannot be more than one service period in the past.
  Example: null
- `churnTime` (string | null)
  Date and time when the subscription is deactivated.
- `renewalTime` (string | null)
  Date and time when the subscription renews.
- `currentPeriodStart` (string)
  Date and time of the current service period start.
- `currentPeriodEnd` (string)
  Date and time of the current service period end.
- `rebillNumber` (integer | null)
  Current billing period number.
- `lineItems` (array)
  Subscription line items which queue until the next renewal, or interim, invoice is issued for the subscription.
- `lineItems.type` (string)
  Type of invoice line item.
  Enum: "debit", "credit"
- `lineItems.description` (string)
  Description of the line item.
- `lineItems.unitPriceAmount` (number)
  Unit price of the line item.
  Example: 49.95
- `lineItems.unitPriceCurrency` (string)
  Currency code in ISO 4217 format.
  Example: USD
- `lineItems.quantity` (integer)
  Quantity of the line item.
  Example: 1
- `lineItems.periodStartTime` (string)
  Date and time when the service period begins for this item.
- `lineItems.periodEndTime` (string)
  Date and time when the service period ends for this item.
- `lineItems.createdTime` (string)
  Date and time when the resource is created. This value is set automatically when the resource is created.
- `lineItems.updatedTime` (string)
  Date and time when the resource is updated. This value is set automatically when the resource is updated.
- `lineItemSubtotal` (object)
  Subtotal of line items in this subscription (signed value). If credits exceed debits, this value is a negative number.
- `lineItemSubtotal.amount` (number)
  Amount of the subtotal.
  Example: 49.95
- `mrr` (number)
  Monthly recurring revenue of the order.
  Example: 49.95
- `paymentInstrumentId` (string | null)
  ID of the payment instrument to use for autopay. If this value is not provided, or if the payment instrument is inactive, the customer's default payment instrument is used.
  Example: inst_0YVB8KPKNXCBR9EDX7JHSED75N
- `billingStatus` (string)
  Billing status of the most recent invoice. This value is used to determine whether to change the service status of the service, such as suspending the service.
  Enum: "draft", "unpaid", "past-due", "abandoned", "paid", "voided", "refunded", "disputed", "partially-refunded", "partially-paid"
- `websiteId` (string, required)
  ID of the website. A website is where an organization obtains a customer. For more information, see [Obtain an organization ID and website ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id). > **Note:** The ID of the website cannot be changed after creation.
  Example: web_0YV7DE4Z26DQSA1AC92FBJ7SEG
- `initialInvoiceId` (string | null)
  ID of the initial invoice.
  Example: in_0YVF9605RKC62BP14NE2R7V2XT
- `recentInvoiceId` (string | null)
  ID of the most recently issued invoice. The invoice might not be `paid` yet.
  Example: in_0YVF9605RKC62BP14NE2R7V2XT
- `items` (array, required)
  Details of items in the order.
- `items.id` (string)
  ID of the order item.
- `items.planId` (string)
  ID of the plan. > **Note:** This field is deprecated. Use the `plan.id` field instead.
  Example: plan_0YV7DENSVGDBW9S71XZNNYYQ0X
- `items.quantity` (integer)
  Number of product units in the specified plan.
- `items.quantityFilled` (number | null)
  Number of filled product units.
  Example: 5.125
- `items.plan` (any, required)
- `items.usageLimits` (any)
- `items.usageStatus` (any)
- `items.revision` (integer)
  Revision number that increments with each overriding change to this specific plan item.
- `items.isModified` (boolean)
  Specifies if the plan information is modified for this subscription.
- `items.isGrandfathered` (boolean)
  Specifies if the current plan revision number is greater than the plan item revision number.
- `items.excludeFromMrr` (boolean)
  Specifies if this item should be excluded from monthly recurring revenue calculations.
- `items._embedded` (object)
  Embedded objects that are requested by the `expand` query parameter.
- `items._embedded.product` (object)
- `deliveryAddress` (any)
  Delivery address of the order. Changes to the delivery address apply to the upcoming invoice and to invoices created after the change. Issued invoices are not updated unless the order is `pending`. To change the delivery address on an unpaid, past-due, or partially paid invoice, use the [upsert an invoice API operation](https://www.rebilly.com/catalog/all/invoices/putinvoice#invoices/putinvoice/t=request&path=deliveryaddress).
- `billingAddress` (any)
  Billing address of the order. Changes to the billing address apply to the upcoming invoice and to invoices created after the change. Issued invoices are not updated unless the order is `pending`. To change the billing address on an issued invoice that has no payment attempts or applied credits, use the [upsert an invoice API operation](https://www.rebilly.com/catalog/all/invoices/putinvoice#invoices/putinvoice/t=request&path=billingaddress).
- `activationTime` (string | null)
  Date and time when the order is activated.
- `voidTime` (string | null)
  Date and time when the order is voided.
- `abandonTime` (string | null)
  Date and time when the pending order is automatically abandoned. If this value is not passed during order creation, a [pending order TTL](https://www.rebilly.com/catalog/all/organizations/patchorganization#organizations/patchorganization/t=request&path=settings/billing/pendingorderttl) setting is used to calculate the value.
- `delinquencyPeriod` (string | null)
  Length of time, in ISO-8601 durations format, which is added to the due time of the order when setting the delinquency time for all related invoices. When the delinquency time of an invoice is reached, the order is automatically canceled. - If the `delinquencyPeriod` value is `null`, the order does not change state and remains active. You must explicitly configure the delinquency period to enable automatic cancellation of unpaid orders. - If you add a delinquency period to an active order, it is applied to all new invoices created for the order. It is not applied to the unpaid and past-due invoices. To apply a delinquency period to unpaid and past-due invoices, set the `delinquencyTime` parameter using the [upsert an invoice API operation](https://www.rebilly.com/catalog/all/invoices/putinvoice#invoices/putinvoice/t=request&path=delinquencytime). If this value is not passed during order creation, an [order delinquency period](https://www.rebilly.com/catalog/all/organizations/patchorganization#organizations/patchorganization/t=request&path=settings/billing/orderdelinquencyperiod) setting is used to calculate the value.
  Example: P7D
- `poNumber` (string | null)
  Purchase order number displayed on the issued invoices.
  Example: PO123456
- `sandboxRetention` (object | null)
  Sandbox recurring order retention. In the sandbox environment, a recurring order is canceled 90 days after it is created or on the start date of the policy, whichever is later. The order is not canceled if it is retained or if the organization is excluded from the policy. This property is returned in the sandbox environment only, for recurring orders. In the live environment, if the request includes this property with a value, a validation error is returned. A `null` value in a request does not update the property.
- `sandboxRetention.autoCancelTime` (string | null)
  Date and time of the automatic cancellation of the order: 90 days after the order is created or the start date of the policy, whichever is later. This value is `null` when the organization is excluded from the policy, and for an order that can no longer bill, such as a churned or abandoned order.
  Example: 2027-01-10T06:00:00+00:00
- `sandboxRetention.excluded` (boolean, required)
  Specifies if the order is retained and not canceled on its `autoCancelTime`. An organization retains up to 50 recurring orders. If the request omits `sandboxRetention`, this value is not updated.
  Example: false
- `shipping` (object)
  Shipping settings.
- `notes` (string)
  Notes for the customer displayed on the order invoice.
- `canceledTime` (string | null)
  Date and time when a subscription is canceled.
- `canceledBy` (string | null)
  Specifies who initiated the cancellation.
  Enum: "merchant", "customer", "rebilly", null
- `cancelCategory` (string | null)
  Category of the cancellation. The `sandbox-retention` value is set only in the sandbox environment when a recurring order is canceled 90 days after creation.
  Enum: "billing-failure", "delinquency", "did-not-use", "did-not-want", "missing-features", "bugs-or-problems", "do-not-remember", "risk-warning", "contract-expired", "too-expensive", "never-started", "switched-plan", "organization-deactivated", "sandbox-retention", "other", null
- `cancelDescription` (string | null)
  Description of the cancellation reason in free form.
- `revision` (integer)
  Number of times the order data has been modified. The revision is useful when analyzing webhook data to determine if the change takes precedence over the current representation.
- `riskMetadata` (any)
  Risk metadata. If this value is `null`, this field uses risk metadata that is captured when creating the payment token.
- `billingPortalToken` (string | null)
  Customer JWT to access a billing portal. This field is presented only if a billing portal exists. This is an experimental field and can be changed or removed in the future.
- `customFields` (object)
  Use custom fields to extend a resource scheme to include custom data that is not provided as a common field. For more information, see [Custom fields](https://www.rebilly.com/catalog/all/custom-fields).
  Example: {"foo":"bar"}
- `_links` (array)
  Related links.
- `_links.href` (string)
  Link URL.
- `_links.rel` (string)
  Type of link.
  Enum: "self", "website", "customer", "initialInvoice", "recentInvoice", "approvalUrl", "attachments", "leadSource"
- `_embedded` (object)
  Embedded objects that are requested by the `expand` query parameter.
- `_embedded.recentInvoice` (object)
- `_embedded.initialInvoice` (object)
- `_embedded.customer` (object)
- `_embedded.website` (object)
- `_embedded.leadSource` (object)
- `_embedded.shippingRate` (object)
- `_embedded.paymentInstrument` (object)
- `_embedded.upcomingInvoice` (object)
- `id` (string)
  ID of the one-time sale.
  Example: ots_01HRF27SATGE4Z6PBJE6PD8328
- `orderType` (string, required)
  Specifies the type of order. An order may be a subscription or a one-time purchase.
  Enum: "one-time-order"
- `status` (string)
  Status of the one-time order.
  Enum: "pending", "abandoned", "completed", "canceled"
- `websiteId` (string, required)
  ID of the website. A website is where an organization obtains a customer. For more information, see [Obtain an organization ID and website ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
  Example: web_0YV7DE4Z26DQSA1AC92FBJ7SEG
- `initialInvoiceId` (string | null)
  ID of the initial invoice (`null` for one-time orders).
  Example: in_0YVF9605RKC62BP14NE2R7V2XT
- `deliveryAddress` (any)
  Delivery address of the order.
- `billingAddress` (any)
  Billing address of the order.

## Response 401 fields

- `status` (integer)
  HTTP status code.
- `type` (string)
  Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference. It should provide human-readable documentation for the problem type. When this member is not present, its value is assumed to be "about:blank".
- `title` (string)
  Short, human-readable summary of the problem type. Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem.
- `detail` (string)
  Human-readable explanation that is specific to this occurrence of the problem.
- `instance` (string)
  URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.

## Response 403 fields

- `status` (integer)
  HTTP status code.
- `error` (string)
  Message that describes why the request is forbidden. Most responses use a descriptive message, such as `Not allowed to change security settings`. If the organization requires multi-factor authentication (MFA) and MFA verification has not been completed for the session, this value is `mfa_required`. If MFA verification has not been completed for the session and the operation requires a confirmed session, this value is `mfa_required_for_caller`. This includes turning on `requireMfa` and resetting MFA for a user. If the organization restricts access to a list of IP addresses and the request comes from an IP address that is not in the list, this value is `ip_not_allowed`.
- `organizationId` (string)
  Unique organization identifier. An organization is an entity that represents a company. For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
  Example: org_0YVDM8RC7GDADADSBSMW124JA8
- `type` (string)
  Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference. It should provide human-readable documentation for the problem type. When this member is not present, its value is assumed to be "about:blank".
- `title` (string)
  Short, human-readable summary of the problem type. Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem.
- `detail` (string)
  Human-readable explanation that is specific to this occurrence of the problem.
- `instance` (string)
  URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
