# List orders

Endpoint: GET /orders/{direction}
Version: 1.0.450.36533
Security: OAuth2

## Path parameters:

  - `direction` (string, required)
    Direction of the order, from the current user's perspective.
    Enum: "Incoming", "Outgoing", "All"

## Query parameters:

  - `buyerID` (string)
    ID of the buyer.

  - `supplierID` (string)
    ID of the supplier.

  - `from` (string)
    Lower bound of date range that the order was created.

  - `to` (string)
    Upper bound of date range that the order was created.

  - `search` (string)
    Word or phrase to search for.

  - `searchOn` (array)
    Comma-delimited list of fields to search on.
    Enum: "ID", "FromCompanyID", "ToCompanyID", "Comments"

  - `searchType` (string)
    Type of search to perform.
    Enum: "AnyTerm", "AllTermsAnyField", "AllTermsSameField", "ExactPhrase", "ExactPhrasePrefix"

  - `sortBy` (array)
    Comma-delimited list of fields to sort by.
    Enum: "DateSubmitted", "DateCreated", "ID", "FromCompanyID", "ToCompanyID", "FromUserID", "Status", "DateApproved", "DateDeclined", "DateCanceled", "DateCompleted", "LastUpdated", "Subtotal", "ShippingCost", "TaxCost", "Gratuity", "Fees", "BaseDiscount", "PromotionDiscount", "Total", "IsSubmitted", "!DateSubmitted", "!DateCreated", "!ID", "!FromCompanyID", "!ToCompanyID", "!FromUserID", "!Status", "!DateApproved", "!DateDeclined", "!DateCanceled", "!DateCompleted", "!LastUpdated", "!Subtotal", "!ShippingCost", "!TaxCost", "!Gratuity", "!Fees", "!BaseDiscount", "!PromotionDiscount", "!Total", "!IsSubmitted"

  - `page` (integer)
    Page of results to return. When paginating through many items (> page 30), we recommend the "Last ID" method, as outlined in the Advanced Querying documentation.

  - `pageSize` (integer)
    Number of results to return per page.

  - `filters` (object)
    An object or dictionary representing key/value pairs to apply as filters. Valid keys are top-level properties of the returned model or 'xp.???'

## Response 200 fields (application/json):

  - `Items` (array)
    Example: [{"ID":"","FromUser":{"ID":"","CompanyID":"","Username":"","Password":"","FirstName":"","LastName":"","Email":"","Phone":"","TermsAccepted":"2018-01-01T00:00:00-06:00","Active":false,"xp":{},"AvailableRoles":[""],"Locale":{"ID":"","OwnerID":"","Currency":"","Language":""},"DateCreated":"2018-01-01T00:00:00-06:00","LastActive":"2018-01-01T00:00:00-06:00","PasswordLastSetDate":"2018-01-01T00:00:00-06:00"},"FromCompanyID":"","ToCompanyID":"","FromUserID":"","BillingAddressID":"","BillingAddress":{"ID":"","DateCreated":"2018-01-01T00:00:00-06:00","CompanyName":"","FirstName":"","LastName":"","Street1":"","Street2":"","City":"","State":"","Zip":"","Country":"","Phone":"","AddressName":"","xp":{}},"ShippingAddressID":"","Comments":"","LineItemCount":0,"Status":"Unsubmitted","DateCreated":"2018-01-01T00:00:00-06:00","DateSubmitted":"2018-01-01T00:00:00-06:00","DateApproved":"2018-01-01T00:00:00-06:00","DateDeclined":"2018-01-01T00:00:00-06:00","DateCanceled":"2018-01-01T00:00:00-06:00","DateCompleted":"2018-01-01T00:00:00-06:00","LastUpdated":"2018-01-01T00:00:00-06:00","Subtotal":0,"ShippingCost":0,"TaxCost":0,"Gratuity":0,"Fees":0,"BaseDiscount":0,"PromotionDiscount":0,"Currency":"","Total":0,"IsSubmitted":false,"SubscriptionID":"","xp":{}}]

  - `Items.ID` (string)

  - `Items.FromUser` (object)
    User placing the order.
    Example: {"ID":"","CompanyID":"","Username":"","Password":"","FirstName":"","LastName":"","Email":"","Phone":"","TermsAccepted":"2018-01-01T00:00:00-06:00","Active":false,"xp":{},"AvailableRoles":[""],"Locale":{"ID":"","OwnerID":"","Currency":"","Language":""},"DateCreated":"2018-01-01T00:00:00-06:00","LastActive":"2018-01-01T00:00:00-06:00","PasswordLastSetDate":"2018-01-01T00:00:00-06:00"}

  - `Items.FromUser.ID` (string)

  - `Items.FromUser.CompanyID` (string)

  - `Items.FromUser.Username` (string)
    Must be unique across all organizations.

  - `Items.FromUser.Password` (string)

  - `Items.FromUser.FirstName` (string)

  - `Items.FromUser.LastName` (string)

  - `Items.FromUser.Email` (string)

  - `Items.FromUser.Phone` (string)

  - `Items.FromUser.TermsAccepted` (string)
    Example: "2018-01-01T00:00:00-06:00"

  - `Items.FromUser.Active` (boolean)
    If false, authentication is prohibited.

  - `Items.FromUser.xp` (object)
    Example: {}

  - `Items.FromUser.AvailableRoles` (array)
    List of roles currently available to the user via all security profile assignments.
    Example: [""]

  - `Items.FromUser.Locale` (object)
    Most specific locale assigned to the user, if any.
    Example: {"ID":"","OwnerID":"","Currency":"","Language":""}

  - `Items.FromUser.Locale.ID` (string)

  - `Items.FromUser.Locale.OwnerID` (string)
    ID of the organization that owns the Locale. Only the marketplace owner can override the OwnerID on create.

  - `Items.FromUser.Locale.Currency` (string)
    We recommend using ISO-4217 currency codes for compatibility with tax and payment processors.

  - `Items.FromUser.Locale.Language` (string)
    We recommend using ISO-639 language code - ISO-3166 Country code (e.g. en-US).

  - `Items.FromUser.DateCreated` (string)
    Example: "2018-01-01T00:00:00-06:00"

  - `Items.FromUser.LastActive` (string)
    Accurate within a few minutes. Includes impersonation activity.
    Example: "2018-01-01T00:00:00-06:00"

  - `Items.FromUser.PasswordLastSetDate` (string)
    Can be used in conjunction with SecurityProfile.PasswordConfig to enforce password reset schedules.
    Example: "2018-01-01T00:00:00-06:00"

  - `Items.FromCompanyID` (string)
    ID of the Buyer placing the order, or the marketplace owner when an order is being forwarded. Mainly useful to the marketplace owner or supplier receiving it.

  - `Items.ToCompanyID` (string)
    ID of the marketplace owner or supplier receiving the order, only writable on create. Mainly useful to the user placing it.

  - `Items.FromUserID` (string)
    This property is only writable when creating an order on behalf of a buyer user.

  - `Items.BillingAddressID` (string)

  - `Items.BillingAddress` (object)
    Example: {"ID":"","DateCreated":"2018-01-01T00:00:00-06:00","CompanyName":"","FirstName":"","LastName":"","Street1":"","Street2":"","City":"","State":"","Zip":"","Country":"","Phone":"","AddressName":"","xp":{}}

  - `Items.BillingAddress.ID` (string)

  - `Items.BillingAddress.DateCreated` (string)
    Example: "2018-01-01T00:00:00-06:00"

  - `Items.BillingAddress.CompanyName` (string)

  - `Items.BillingAddress.FirstName` (string)

  - `Items.BillingAddress.LastName` (string)

  - `Items.BillingAddress.Street1` (string)

  - `Items.BillingAddress.Street2` (string)

  - `Items.BillingAddress.City` (string)

  - `Items.BillingAddress.State` (string)

  - `Items.BillingAddress.Zip` (string)

  - `Items.BillingAddress.Country` (string)

  - `Items.BillingAddress.Phone` (string)

  - `Items.BillingAddress.AddressName` (string)

  - `Items.BillingAddress.xp` (object)
    Example: {}

  - `Items.ShippingAddressID` (string)
    ID of the ShippingAddress for all line items on the order. Null when there are multiple shipping addresses defined.

  - `Items.Comments` (string)

  - `Items.LineItemCount` (integer)

  - `Items.Status` (string)
    Enum: "Unsubmitted", "AwaitingApproval", "Declined", "Open", "Completed", "Canceled"

  - `Items.DateCreated` (string)
    Example: "2018-01-01T00:00:00-06:00"

  - `Items.DateSubmitted` (string)
    Null until the order passes from the buyer to the marketplace owner, including when Status is PendingApproval.
    Example: "2018-01-01T00:00:00-06:00"

  - `Items.DateApproved` (string)
    Example: "2018-01-01T00:00:00-06:00"

  - `Items.DateDeclined` (string)
    Example: "2018-01-01T00:00:00-06:00"

  - `Items.DateCanceled` (string)
    Example: "2018-01-01T00:00:00-06:00"

  - `Items.DateCompleted` (string)
    Populated when all items on an order have shipped, or the order is explicitly completed.
    Example: "2018-01-01T00:00:00-06:00"

  - `Items.LastUpdated` (string)
    Example: "2018-01-01T00:00:00-06:00"

  - `Items.Subtotal` (number)
    Sum of all LineItem.LineSubtotals.

  - `Items.ShippingCost` (number)
    Modifying requires OverrideShipping role.

  - `Items.TaxCost` (number)
    Modifying requires TaxOverride role.

  - `Items.Gratuity` (number)

  - `Items.Fees` (number)
    Fees associated with order or line items

  - `Items.BaseDiscount` (number)
    Sum of all discount amounts from discount assignments applied to line items on this order.

  - `Items.PromotionDiscount` (number)
    Sum of all promotion amounts applied to the order.

  - `Items.Currency` (string)
    Inherited from the user placing the order.

  - `Items.Total` (number)
    Subtotal - BaseDiscount - PromotionDiscount + TaxCost + ShippingCost + Gratuity + Fees

  - `Items.IsSubmitted` (boolean)
    True if this order has been passed from the Buyer to the marketplace owner or supplier.

  - `Items.SubscriptionID` (string)
    ID of the subscription used to create an order in an automated process.

  - `Items.xp` (object)
    Example: {}

  - `Meta` (object)

  - `Meta.Page` (integer)

  - `Meta.PageSize` (integer)

  - `Meta.TotalCount` (integer)

  - `Meta.TotalPages` (integer)

  - `Meta.ItemRange` (array)

  - `Meta.NextPageKey` (string)

## Response 4XX fields (application/json):

  - `StatusCode` (integer)
    Example: "404"

  - `ErrorCode` (string)
    Example: "NotFoundError"

  - `Message` (string)
    Example: "Object not found"

  - `Data` (object)
    Example: {"ObjectType":"","ObjectID":""}


