Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Returns

Retrieving a list of returns

get

Retrieves a list of return documents.

An employee scope with a site suffix retrieves only the returns whose restriction is in that list. The X-Total-Count header uses the same filter. A return with no restriction is omitted. An employee scope without a site suffix returns every return. A customer scope returns that customer's own returns.

Filter by site code with q=siteCode:{siteCode} — for example, q=siteCode:DE.

Required scopes
This endpoint requires the following scopes:
  • : Needed for reading returns by a tenant employee. Without a site suffix, the token can read every return. With a suffix, such as `returns.returns_read--DE`, the token can read only returns whose `restriction` is in that list.
  • : Needed for reading returns by a customer (only customer's own returns).
Authorizations
OAuth2clientCredentialsRequired
Token URL:
Path parameters
tenantstring · min: 3 · max: 16Required

Your Emporix tenant name. Note: The tenant name should always be written in lowercase.

Pattern: ^[a-z][a-z0-9]+$
Query parameters
pageSizeinteger · min: 1 · max: 60Optional

The number of documents being retrieved on one page.

Default: 60
pageNumberinteger · min: 1Optional

The page number to be retrieved, where the size of the pages is specified by the pageSize parameter. The number of the first page is 1.

Default: 1
sortstringOptional

Fields to sort the response data by following the order of the parameters from left to right. Can contain multiple fields in the following format: field name:sort direction, separated by a comma. The colon preceding the sort direction parameter is optional, and the descending order is taken only if it is equal to desc or DESC. The ascending order is assumed in any other case.

Example: sort=name,metadata.createdAt:desc
qstringOptional

A standard query parameter is used to search for specific values.

  • Searching for an item by a string property: q=approvalStatus:PENDING, where approvalStatus is the name of the string field and PENDING is its required value. Searching by site uses the same form: q=siteCode:{siteCode} — for example, q=siteCode:DE.
  • Searching for items by a number-based property:
    • Searching for items with specific values: q=mixins.returnCustomAttributes.orderQuantity:20
    • Searching for items with values greater than: q=mixins.returnCustomAttributes.orderQuantity:>20
    • Searching for items with values lower than: q=mixins.returnCustomAttributes.orderQuantity:<20
    • Searching for items with values greater than or equal to: q=mixins.returnCustomAttributes.orderQuantity:>=20
    • Searching for items with values lower than or equal to: q=mixins.returnCustomAttributes.orderQuantity:<=20
    • Searching for items within a range of values: q=mixins.returnCustomAttributes.orderQuantity:(>=10 AND <=20), where mixins.returnCustomAttributes.orderQuantity is the name of a number-based field, and 20 is its querying value.
  • Searching for items by a date property. All number-based property queries are also valid for dates. In that case, the date should be placed within double quotes: q=metadataCreatedAt:(>="2021-05-18T07:27:27.455Z" AND <"2021-05-20T07:27:27.455Z")
  • Searching for items by a boolean value: q=received:true, where received is the name of a boolean field, and 'true' is its required value.
  • Searching for items with a non-existing or empty property: q=reason.description:null, where reason.description is the name of the field that has the null value.
  • Searching for items with an existing property: q=mixins.mixinName:exists, where the specific mixin named mixinName exists in the database.
  • Searching for items by multiple specific values: q=id:(5c3325baa9812100098ff48f,5c3325d1a9812100098ff494), where id is the name of the field, and strings within a bracket are its required values.
  • Searching for items by multiple fields: q=id:5c3325baa9812100098ff48f code:A705121667, where id and 'code' are the names of fields. All documents that contain the specified values in these fields are returned. Multiple fields separated by spaces can be specified. Multiple values for each field can also be provided in the format presented above.
  • Searching for items with string fields conforming to a regex: q=orders._id:~EON107 or q=code:(~EON107 EON106) - in the case of searching for strings with a space, where order._id is the name of the field and EON107 or EON107 EON106 are its querying regular expressions.
Example: q=approvalStatus:APPROVED
Header parameters
X-Total-CountbooleanOptional

To get information how many entities meet the filtering requirements, the X-Total-Count header has been introduced. The header is optional and its default value is false. If the header is provided and it is set to true, then the total count is returned in the X-Total-Count response header. In both cases (X-Total-Count true, false or not provided), the response body has the same format (array of entities). This means that the information about the total count is returned only on demand, provided that the X-Total-Count header is present in a request.

Responses
200

Example response

application/json
Responseany of
or
get/return/{tenant}/returns
GET /return/{tenant}/returns HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
[
  {
    "id": "7ba2f2b6-7dc8-45ff-9f20-4e6163c14c2e",
    "siteCode": "DE",
    "restriction": "DE",
    "approvalStatus": "PENDING",
    "received": false,
    "orders": [
      {
        "id": "B1LMYY52",
        "items": [
          {
            "id": "32090",
            "name": "T-shirt",
            "quantity": 2,
            "reason": {
              "code": "001",
              "details": "It's too small"
            },
            "unitPrice": {
              "value": 1.99,
              "currency": "USD"
            },
            "total": {
              "value": 3.98,
              "currency": "USD"
            },
            "calculatedUnitPrice": {
              "netValue": 1.68,
              "grossValue": 1.99,
              "taxValue": 0.31,
              "taxCode": "STANDARD",
              "taxRate": 19
            },
            "calculatedPrice": {
              "finalPrice": {
                "netValue": 3.36,
                "grossValue": 3.98,
                "taxValue": 0.62,
                "taxCode": "STANDARD",
                "taxRate": 19
              }
            }
          },
          {
            "id": "32102",
            "name": "Jacket",
            "quantity": 15,
            "unitPrice": {
              "value": 1,
              "currency": "USD"
            },
            "total": {
              "value": 15,
              "currency": "USD"
            },
            "calculatedUnitPrice": {
              "netValue": 0.84,
              "grossValue": 1,
              "taxValue": 0.16,
              "taxCode": "STANDARD",
              "taxRate": 19
            },
            "calculatedPrice": {
              "finalPrice": {
                "netValue": 12.6,
                "grossValue": 15,
                "taxValue": 2.4,
                "taxCode": "STANDARD",
                "taxRate": 19
              }
            }
          }
        ]
      }
    ],
    "reason": {
      "code": "001",
      "details": "The items do not work."
    },
    "total": {
      "value": 18.98,
      "currency": "USD"
    },
    "calculatedPrice": {
      "finalPrice": {
        "netValue": 15.96,
        "grossValue": 18.98,
        "taxValue": 3.02,
        "taxCode": "STANDARD",
        "taxRate": 19
      }
    },
    "expiryDate": "2023-04-31T13:18:02.379Z",
    "metadata": {
      "createdAt": "2023-04-31T13:18:02.379Z",
      "modifiedAt": "2023-04-31T13:18:02.379Z",
      "version": 1
    }
  }
]

Creating a single return

post

Creates a single return document with given information. If a return is created by a customer directly, then the returns.returns_manage_own scope is required. If a return is created by a tenant employee on behalf of a customer, then the returns.returns_manage scope is required.

The service copies siteCode and restriction from the referenced orders. You can omit both. A sent value that differs from the orders returns 400 with message site does not match order. Orders that disagree on siteCode or on restriction return 400 with message orders belong to different sites.

An employee scope with a site suffix, such as returns.returns_manage--DE, can create a return only for that site. Creating a return outside that site, including a return whose copied restriction is empty, returns 403 with message Creating a return for this site is not allowed.

Note: Depending on a case, a different set of fields is required and allowed.

Required scopes
This endpoint requires the following scopes:
  • : Needed to manage returns by a tenant employee. Without a site suffix, the token can manage every return. With a suffix, such as `returns.returns_manage--DE`, the token can manage only returns whose `restriction` is in that list.
  • : Needed to manage returns by a customer (only customer's own returns).
Authorizations
OAuth2clientCredentialsRequired
Token URL:
Path parameters
tenantstring · min: 3 · max: 16Required

Your Emporix tenant name. Note: The tenant name should always be written in lowercase.

Pattern: ^[a-z][a-z0-9]+$
Header parameters
saas-tokenstringOptional

Customer saasToken retrieved when logging in a customer. The header is mandatory for operations done by a customer.

Body
or
or
Responses
201

The resource has been successfully created.

application/json
idstringOptional

Unique identifier of the created return.

post/return/{tenant}/returns
POST /return/{tenant}/returns HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 445

{
  "siteCode": "DE",
  "restriction": "DE",
  "orders": [
    {
      "id": "B1LMYY52",
      "items": [
        {
          "id": "32090",
          "quantity": 2,
          "reason": {
            "code": "001"
          }
        },
        {
          "id": "32102",
          "quantity": 15,
          "reason": {
            "details": "It's too small."
          }
        }
      ]
    }
  ],
  "reason": {
    "code": "001",
    "details": "The items do not work."
  },
  "mixins": {
    "customAttributes": {
      "attr1": "value1"
    }
  },
  "metadata": {
    "mixins": {
      "customAttributes": "https://res.cloudinary.com/saas-ag/raw/upload/emporix-docs/productCustomAttributesMixIn.v29.json"
    }
  }
}
{
  "id": "88b1779c-a8bf-4b94-b1be-b0edd149bba5"
}

Retrieving a single return

get

Retrieves a single return document.

A site-limited employee who requests a return outside that site, or a return with no restriction, receives 404 with message The return with id {id} has not been found. An employee scope without a site suffix can retrieve every return.

Required scopes
This endpoint requires the following scopes:
  • : Needed for reading returns by a tenant employee. Without a site suffix, the token can read every return. With a suffix, such as `returns.returns_read--DE`, the token can read only returns whose `restriction` is in that list.
  • : Needed for reading returns by a customer (only customer's own returns).
Authorizations
OAuth2clientCredentialsRequired
Token URL:
Path parameters
tenantstring · min: 3 · max: 16Required

Your Emporix tenant name. Note: The tenant name should always be written in lowercase.

Pattern: ^[a-z][a-z0-9]+$
returnIdstringRequired

Unique identifier of a return.

Responses
200Success
application/json
or
get/return/{tenant}/returns/{returnId}
GET /return/{tenant}/returns/{returnId} HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
{
  "id": "7ba2f2b6-7dc8-45ff-9f20-4e6163c14c2e",
  "siteCode": "DE",
  "restriction": "DE",
  "approvalStatus": "PENDING",
  "received": false,
  "orders": [
    {
      "id": "B1LMYY52",
      "items": [
        {
          "id": "32090",
          "name": "T-shirt",
          "quantity": 2,
          "reason": {
            "code": "001",
            "details": "It's too small"
          },
          "unitPrice": {
            "value": 1.99,
            "currency": "USD"
          },
          "total": {
            "value": 3.98,
            "currency": "USD"
          },
          "calculatedUnitPrice": {
            "netValue": 1.68,
            "grossValue": 1.99,
            "taxValue": 0.31,
            "taxCode": "STANDARD",
            "taxRate": 19
          },
          "calculatedPrice": {
            "finalPrice": {
              "netValue": 3.36,
              "grossValue": 3.98,
              "taxValue": 0.62,
              "taxCode": "STANDARD",
              "taxRate": 19
            }
          }
        },
        {
          "id": "32102",
          "name": "Jacket",
          "quantity": 15,
          "unitPrice": {
            "value": 1,
            "currency": "USD"
          },
          "total": {
            "value": 15,
            "currency": "USD"
          },
          "calculatedUnitPrice": {
            "netValue": 0.84,
            "grossValue": 1,
            "taxValue": 0.16,
            "taxCode": "STANDARD",
            "taxRate": 19
          },
          "calculatedPrice": {
            "finalPrice": {
              "netValue": 12.6,
              "grossValue": 15,
              "taxValue": 2.4,
              "taxCode": "STANDARD",
              "taxRate": 19
            }
          }
        }
      ]
    }
  ],
  "reason": {
    "code": "001",
    "details": "The items do not work."
  },
  "total": {
    "value": 18.98,
    "currency": "USD"
  },
  "calculatedPrice": {
    "finalPrice": {
      "netValue": 15.96,
      "grossValue": 18.98,
      "taxValue": 3.02,
      "taxCode": "STANDARD",
      "taxRate": 19
    }
  },
  "expiryDate": "2023-04-31T13:18:02.379Z",
  "metadata": {
    "createdAt": "2023-04-31T13:18:02.379Z",
    "modifiedAt": "2023-04-31T13:18:02.379Z",
    "version": 1
  }
}

Updating a single return

put

Updates a single return document with given information. If a return is updated by a customer directly, then the returns.returns_manage_own scope is required. If a return is updated by a tenant employee on behalf of a customer, then the returns.returns_manage scope is required.

Note: Depending on a case, a different set of fields is required and allowed.

A customer can change a return only when the return approval status is PENDING.

The request body does not accept siteCode or restriction. The stored values stay as they were set when the return was created. Attaching an order from a different site, or with a different restriction, returns 400 with message site does not match order or orders belong to different sites.

A site-limited employee who updates a return outside that site, or a return with no restriction, receives 404 with message The return with id {id} has not been found.

Required scopes
This endpoint requires the following scopes:
  • : Needed to manage returns by a tenant employee. Without a site suffix, the token can manage every return. With a suffix, such as `returns.returns_manage--DE`, the token can manage only returns whose `restriction` is in that list.
  • : Needed to manage returns by a customer (only customer's own returns).
Authorizations
OAuth2clientCredentialsRequired
Token URL:
Path parameters
tenantstring · min: 3 · max: 16Required

Your Emporix tenant name. Note: The tenant name should always be written in lowercase.

Pattern: ^[a-z][a-z0-9]+$
returnIdstringRequired

Unique identifier of a return.

Header parameters
saas-tokenstringOptional

Customer saasToken retrieved when logging in a customer. The header is mandatory for operations done by a customer.

Body
or
Responses
204

No Content

No content

put/return/{tenant}/returns/{returnId}
PUT /return/{tenant}/returns/{returnId} HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 286

{
  "id": "6369140c5c6de75d9e84c97f",
  "orders": [
    {
      "id": "B1LMYY52",
      "items": [
        {
          "id": "32090",
          "quantity": 2,
          "reason": {
            "code": "001"
          }
        },
        {
          "id": "32102",
          "quantity": 15
        }
      ]
    }
  ],
  "reason": {
    "code": "001",
    "details": "The items do not work."
  },
  "mixins": {
    "customAttributes": {
      "attr1": "value1"
    }
  },
  "metadata": {
    "version": 1
  }
}

No content

Deleting a single return

delete

Deletes a single return document. The return can be deleted completely only by an employee, that is a user who has the returns.returns_manage scope granted. A customer, who has the returns.returns_manage_own scope granted, can delete a return only if the return status is PENDING. The return status is changed to CLOSED during the delete operation. A site-limited employee who deletes a return outside that site, or a return with no restriction, receives 404 with message The return with id {id} has not been found.

Required scopes
This endpoint requires the following scopes:
  • : Needed to manage returns by a tenant employee. Without a site suffix, the token can manage every return. With a suffix, such as `returns.returns_manage--DE`, the token can manage only returns whose `restriction` is in that list.
  • : Needed to manage returns by a customer (only customer's own returns).
Authorizations
OAuth2clientCredentialsRequired
Token URL:
Path parameters
tenantstring · min: 3 · max: 16Required

Your Emporix tenant name. Note: The tenant name should always be written in lowercase.

Pattern: ^[a-z][a-z0-9]+$
returnIdstringRequired

Unique identifier of a return.

Header parameters
saas-tokenstringOptional

Customer saasToken retrieved when logging in a customer. The header is mandatory for operations done by a customer.

Responses
204

No Content

No content

delete/return/{tenant}/returns/{returnId}
DELETE /return/{tenant}/returns/{returnId} HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*

No content

Partially updating a single return

patch

Parial update of a single return document with given information. If a return is updated by a customer directly, then the returns.returns_manage_own and returns.returns_read_own scopes are required. If a return is updated by a tenant employee on behalf of a customer, then the returns.returns_manage and returns.returns_read scopes are required.

Note: Depending on a case, a different set of fields is allowed.

A customer can change a return only when the return approval status is PENDING.

The patch body does not accept siteCode or restriction. The stored values stay as they were set when the return was created. A site-limited employee who patches a return outside that site, or a return with no restriction, receives 404 with message The return with id {id} has not been found. The service returns that 404 before it applies the patch.

The patch request consists of set of operation, that should be defined according to RFC-6902 standard

Required scopes
This endpoint requires the following scopes:
  • : Needed to manage returns by a tenant employee. Without a site suffix, the token can manage every return. With a suffix, such as `returns.returns_manage--DE`, the token can manage only returns whose `restriction` is in that list.
  • : Needed to manage returns by a customer (only customer's own returns).
Authorizations
OAuth2clientCredentialsRequired
Token URL:
Path parameters
tenantstring · min: 3 · max: 16Required

Your Emporix tenant name. Note: The tenant name should always be written in lowercase.

Pattern: ^[a-z][a-z0-9]+$
returnIdstringRequired

Unique identifier of a return.

Header parameters
saas-tokenstringOptional

Customer saasToken retrieved when logging in a customer. The header is mandatory for operations done by a customer.

Bodyobject · patchRequest[]
opstring · enumRequired

Indicates an operation which should be done on a return. Available operations: add remove and replace

Possible values:
pathstringRequired

Indicates a path for which the value should be applied. For example: /mixins/additionalAttributes/externalId, /approvalStatus, /requestor/customerId

valueone ofOptional

Indicates a value that should be changed or added. The value can be of a primitive type, like string, number, boolean or it can be an object or an array.

objectOptional
or
stringOptional
Responses
204

No Content

No content

patch/return/{tenant}/returns/{returnId}
PATCH /return/{tenant}/returns/{returnId} HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 77

[
  {
    "op": "replace",
    "path": "/requestor/customerId",
    "value": "changedCustomerId"
  }
]

No content

Last updated

Was this helpful?