---
schema_version: "1"
id: b1673f0134d4ba606e7051c36d03add3ea74a53d6907fefe859d7a0bab11f837
title: Gift Certificates
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/commerce-api/references/generated-api-specs/gift-certificates.md
canonical_url: https://developer.salesforce.com/docs/commerce/commerce-api/references/gift-certificates
source_site: developer.salesforce.com
content_type: documentation
content_hash: 2b8581d388eee45e175fa8db220eb0e066f61adacaab2e2e39f969900ce43268
products:
  - B2C Commerce API
  - Salesforce APIs
---
Gift Certificates

# Gift Certificates

[Download API specification](https://developer.salesforce.com/static/commercecloud/commerce-api/gift-certificates/gift-certificates-oas-v1-public.yaml)

## API Overview

Use the Gift Certificates API to create, update, and delete gift certificates, so that your storefront customers can purchase and redeem gift certificates.

### Authentication & Authorization

The client requesting the gift certificate information must have access to the Gift Certificates resource. For resource access, you must use a client ID and client secret from Account Manager to request an access token. The access token is used as a bearer token and added to the Authorization header of your API request. The client must first authenticate against Account Manager to log in.

You must include the relevant scope(s) in the client ID used to generate the token. For details, see [Authorization Scopes Catalog.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/auth-z-scope-catalog.html)

For detailed setup instructions, see [Authorization for Admin APIs](https://developer.salesforce.com/docs/commerce/commerce-api/guide/authorization-for-admin-apis.html).

### Response Details

#### Timeouts

Admin API requests must respond within 60 seconds. If a response exceeds this threshold, an HTTP 504 status code is returned. For details, see [Timeouts and Limits.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/timeouts-limits.html)

#### Error Handling

Error responses follow the [RFC 7807](https://datatracker.ietf.org/doc/html/rfc7807) problem detail format. To trace errors, include a `correlation-id` header in your request — the response returns it as `x-correlation-id`. For details, see [HTTP Status Codes and Errors.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/error-response-codes.html)

### Use Cases

#### Capture All Gift Certificates

Retrieve all gift certificates for a site with no filtering.

#### Capture Specific Gift Certificates

Retrieve a specific gift certificate for a site using a merchant ID.

#### Create Site Specific Gift Certificates

Create and issue site-specific gift certificates with information such as amount, description, status, recipient email, recipient name, sender name, and so on.

#### Update Gift Certificates

Update a gift certificate with specified information using a merchant ID.

### Related APIs

*   [Shopper Gift Certificates](https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-gift-certificates?meta=Summary) — Retrieve gift certificate details for shoppers.

**Version:** 1.0.43

## Servers

*   `https://{shortCode}.api.commercecloud.salesforce.com/pricing/gift-certificates/v1`
    *   `shortCode (default shortCode) An eight-character string assigned to a realm for routing purposes. See [Base URL and Request Formation.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/base-url.html)`

## Security

*   `AmOAuth2` (oauth2) AccountManager OAuth 2.0 bearer token Authentication.
    *   OAuth flow clientCredentials (tokenUrl: https://account.demandware.com/dwsso/oauth2/access\_token)
    *   Scope sfcc.gift-certificates: gift certificate READONLY
    *   Scope sfcc.gift-certificates.rw: gift certificate read/write
    *   OAuth flow authorizationCode (authorizationUrl: https://account.demandware.com/dwsso/oauth2/authorize, tokenUrl: https://account.demandware.com/dwsso/oauth2/access\_token, refreshUrl: https://account.demandware.com/dwsso/oauth2/access\_token)

## Operations

### PUT Create a gift certificate using the information provided.

`PUT /organizations/{organizationId}/gift-certificates`

Operation ID: `createGiftCertificate`. Security: AmOAuth2 (sfcc.gift-certificates.rw).

If an existing identifier is specified, the gift certificate with that unique identifier is deleted and a new one is created.

#### Parameters

*   `organizationId` (path, OrganizationId, required) An identifier for the Salesforce Commerce Cloud organization the request is being made by. It consists of a prefix 'f\_ecom\_' followed by a 4-character [realm identifier](https://developer.salesforce.com/docs/commerce/commerce-api/guide/base-url.html#realm-id) and a 3-character [instance type identifier](https://developer.salesforce.com/docs/commerce/commerce-api/guide/base-url.html#instance-id).
    
    _Example_
    
    ```
    f_ecom_zzxy_prd
    ```
    
*   `siteId` (query, SiteId, required) The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
    
    _Example: SiteId_
    
    ```
    RefArch
    ```
    

#### Request body (required)

Media type: `application/json`. Schema: `GiftCertificate`.

_Example: Gift-Certificates_

```
{
  "amount": {
    "currencyMnemonic": "USD",
    "value": 1000
  },
  "description": "Birthday gift",
  "message": "A birthday present to you",
  "senderName": "Jane Doe",
  "recipientName": "John Doe",
  "recipientEmail": "john.doe@gmail.com",
  "status": "issued",
  "orderNo": "CA17293",
  "enabled": false
}
```

#### Responses

*   **200** Successfully created the gift certificate.
    
    Media type: `application/json`. Schema: `GiftCertificate`.
    
    _Example: CreateGiftCertificateSuccess_
    
    ```
    {
      "amount": {
        "currencyMnemonic": "USD",
        "value": 100
      },
      "balance": {
        "currencyMnemonic": "USD",
        "value": 100
      },
      "creationDate": "2015-07-31T14:36:17.544Z",
      "description": "Birthday gift",
      "enabled": false,
      "maskedGiftCertificateCode": "************KTIP",
      "merchantId": "NorthernTrailOutfitters",
      "message": "A birthday gift for you",
      "orderNo": "CA17293",
      "recipientName": "John Doe",
      "recipientEmail": "john.doe@gmail.com",
      "senderName": "Jane Doe",
      "status": "issued",
      "transactions": [
        {
          "amount": {
            "currencyMnemonic": "EUR",
            "value": 80
          },
          "orderNo": "my-order_no",
          "timestamp": "2015-09-09T17:16:12.066Z",
          "typeCode": "create"
        }
      ]
    }
    ```
    
*   **400**
    
    Potential reasons:
    
    *   Returned when the merchant ID is not unique.
    *   Returned when the specified gift certificate status is invalid.
    *   Returned when the specified gift certificate is not valid (the argument indicates the field that was invalid).
    *   Returned when the specified amount is out of range.
    
    Media type: `application/json`. Schema: `ErrorResponse`.
    
    _Example: InvalidRecipientEmail400_
    
    ```
    {
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/invalid-recipient-email",
      "title": "Invalid Recipient Email Exception",
      "detail": "Invalid recipient email ID provided."
    }
    ```
    
    _Example: InvalidStatus400_
    
    ```
    {
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/invalid-status",
      "title": "Invalid Gift Certificate Status Exception",
      "detail": "Invalid gift certificate status provided."
    }
    ```
    
    _Example: Invalid400_
    
    ```
    {
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/invalid",
      "title": "Invalid Gift Certificate Exception",
      "detail": "Invalid gift certificate provided."
    }
    ```
    
    _Example: MerchantIdNotUnique400_
    
    ```
    {
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/merchant-id-not-unique",
      "title": "Gift Certificate Create Merchant Id Not Unique Exception",
      "detail": "Merchant id is not unique."
    }
    ```
    
*   **404** Returned when the gift certificate does not exist or does not match the specified merchant ID.
    
    Media type: `application/json`. Schema: `ErrorResponse`.
    
    _Example: createGiftCertificate404_
    
    ```
    {
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/not-found",
      "title": "Gift Certificate Not Found Exception",
      "detail": "No gift certificate with merchant ID 'my-merchant_id' for site 'TestWapi' was found."
    }
    ```
    

### POST Search for gift certificates.

`POST /organizations/{organizationId}/gift-certificates`

Operation ID: `giftCertificatesSearch`. Security: AmOAuth2 (sfcc.gift-certificates, sfcc.gift-certificates.rw).

Use the following searchable query attributes to narrow the search:

| Attribute | Type | Sortable |
| --- | --- | --- |
| merchantId | String | yes |
| maskedGiftCertificateCode \* | String | no |
| orderNo | String | yes |
| senderName | String | yes |
| recipientName | String | yes |
| recipientEmail | String | yes |
| status | String | yes |
| enabled | Boolean | yes |
| message | String | yes |
| description | String | yes |
| creationDate | Date | yes |
| currencyMnemonic \*\* | String | yes |

### Notes:

*   \*`maskedGiftCertificateCode`, also known as just code, can only be used in a term query. If a four-character code is supplied, it is assumed that the search is on the unmasked portion of the code. Otherwise, the full code must be matched. Text queries are not allowed.
*   \*\*`currencyMnemonic` can only be joined with other attributes using a conjunction (`AND`).
*   Only searchable attributes can be used in sorting.

#### Parameters

*   `organizationId` (path, OrganizationId, required) An identifier for the Salesforce Commerce Cloud organization the request is being made by. It consists of a prefix 'f\_ecom\_' followed by a 4-character [realm identifier](https://developer.salesforce.com/docs/commerce/commerce-api/guide/base-url.html#realm-id) and a 3-character [instance type identifier](https://developer.salesforce.com/docs/commerce/commerce-api/guide/base-url.html#instance-id).
    
    _Example_
    
    ```
    f_ecom_zzxy_prd
    ```
    
*   `siteId` (query, SiteId, required) The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
    
    _Example: SiteId_
    
    ```
    RefArch
    ```
    

#### Request body

Media type: `application/json`. Schema: `SearchRequest`.

#### Responses

*   **200** Successfully returned the gift certificate information.
    
    Media type: `application/json`. Schema: `GiftCertificateSearchResult`.
    
    _Example: GiftCertificatesSearchSuccess_
    
    ```
    {
      "limit": 3,
      "hits": [
        {
          "amount": {
            "currencyMnemonic": "USD",
            "value": 100
          },
          "balance": {
            "currencyMnemonic": "USD",
            "value": 100
          },
          "creationDate": "2015-07-31T15:10:25.192Z",
          "description": "Birthday Gift",
          "enabled": true,
          "maskedGiftCertificateCode": "************HHHZ",
          "merchantId": "NorthernTrailOutfitters",
          "orderNo": "CA17293",
          "status": "pending",
          "transactions": [
            {
              "amount": {
                "currencyMnemonic": "EUR",
                "value": 80
              },
              "orderNo": "CA17293",
              "timestamp": "2015-01-09T17:16:12.066Z",
              "typeCode": "create"
            }
          ]
        },
        {
          "amount": {
            "currencyMnemonic": "USD",
            "value": 100
          },
          "balance": {
            "currencyMnemonic": "USD",
            "value": 100
          },
          "creationDate": "2015-07-31T15:03:21.988Z",
          "enabled": true,
          "maskedGiftCertificateCode": "************DOIZ",
          "merchantId": "my-merchant_id",
          "orderNo": "00000002",
          "status": "pending",
          "transactions": [
            {
              "amount": {
                "currencyMnemonic": "EUR",
                "value": 80
              },
              "orderNo": "00000002",
              "timestamp": "2015-02-09T17:16:12.066Z",
              "typeCode": "create"
            }
          ]
        },
        {
          "amount": {
            "currencyMnemonic": "USD",
            "value": 100
          },
          "balance": {
            "currencyMnemonic": "USD",
            "value": 100
          },
          "creationDate": "2015-07-31T15:10:00.659Z",
          "description": "Promotion Gift",
          "enabled": true,
          "maskedGiftCertificateCode": "************GSPZ",
          "merchantId": "NorthernTrailOutfitters",
          "orderNo": "00000003",
          "status": "pending",
          "transactions": [
            {
              "amount": {
                "currencyMnemonic": "EUR",
                "value": 80
              },
              "orderNo": "00000003",
              "timestamp": "2015-09-09T17:16:12.066Z",
              "typeCode": "create"
            }
          ]
        }
      ],
      "query": {
        "textQuery": {
          "fields": [
            "status"
          ],
          "searchPhrase": "pending"
        }
      },
      "offset": 0,
      "total": 3
    }
    ```
    
*   **400**
    
    Potential reasons:
    
    *   Returned when the given query field cannot be queried.
    *   Returned when the query is malformed.
    
    Media type: `application/json`. Schema: `ErrorResponse`.
    
    _Example: UnqueryableField400_
    
    ```
    {
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/unqueryable-field",
      "title": "Unqueryable Field Exception",
      "detail": "Given field cannot be queried. For example - The field 'link' is unqueryable."
    }
    ```
    
    _Example: MalformedSearchParameter400_
    
    ```
    {
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/malformed-search-parameter",
      "title": "Malformed Search Parameter Exception",
      "detail": "An error occurred while decoding the request, the body was 'malformed'."
    }
    ```
    

### GET getGiftCertificate

`GET /organizations/{organizationId}/gift-certificates/{merchantId}`

Operation ID: `getGiftCertificate`. Security: AmOAuth2 (sfcc.gift-certificates, sfcc.gift-certificates.rw).

Retrieve gift certificate information for a specified merchant ID.

#### Parameters

*   `organizationId` (path, OrganizationId, required) An identifier for the Salesforce Commerce Cloud organization the request is being made by. It consists of a prefix 'f\_ecom\_' followed by a 4-character [realm identifier](https://developer.salesforce.com/docs/commerce/commerce-api/guide/base-url.html#realm-id) and a 3-character [instance type identifier](https://developer.salesforce.com/docs/commerce/commerce-api/guide/base-url.html#instance-id).
    
    _Example_
    
    ```
    f_ecom_zzxy_prd
    ```
    
*   `merchantId` (path, string, required) The merchant ID of the requested gift certificate.  
    Minimum length: 1.
*   `siteId` (query, SiteId, required) The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
    
    _Example: SiteId_
    
    ```
    RefArch
    ```
    

#### Responses

*   **200** Successfully retrieved the gift certificate information for the specified merchant ID.
    
    Media type: `application/json`. Schema: `GiftCertificate`.
    
    _Example: GetGiftCertificateSuccess_
    
    ```
    {
      "amount": {
        "currencyMnemonic": "USD",
        "value": 100
      },
      "balance": {
        "currencyMnemonic": "USD",
        "value": 100
      },
      "creationDate": "2015-07-31T14:56:38.936Z",
      "description": "Birthday Gift",
      "enabled": true,
      "maskedGiftCertificateCode": "************LKWJ",
      "merchantId": "NorthernTrailOutfitters",
      "message": "A birthday gift for you",
      "orderNo": "CA17293",
      "recipientName": "John Doe",
      "recipientEmail": "john.doe@gmail.com",
      "senderName": "Jane Doe",
      "status": "issued",
      "transactions": [
        {
          "amount": {
            "currencyMnemonic": "EUR",
            "value": 80
          },
          "orderNo": "CA17293",
          "timestamp": "2015-09-09T17:16:12.066Z",
          "typeCode": "create"
        }
      ]
    }
    ```
    
*   **404** Returned when the gift certificate does not exist or does not match the specified merchant ID.
    
    Media type: `application/json`. Schema: `ErrorResponse`.
    
    _Example createGiftCertificate404: same as PUT /organizations/{organizationId}/gift-certificates 404 response._
    

### DELETE Delete gift certificate information for a specified merchant ID.

`DELETE /organizations/{organizationId}/gift-certificates/{merchantId}`

Operation ID: `deleteGiftCertificate`. Security: AmOAuth2 (sfcc.gift-certificates.rw).

#### Parameters

*   `organizationId` (path, OrganizationId, required) An identifier for the Salesforce Commerce Cloud organization the request is being made by. It consists of a prefix 'f\_ecom\_' followed by a 4-character [realm identifier](https://developer.salesforce.com/docs/commerce/commerce-api/guide/base-url.html#realm-id) and a 3-character [instance type identifier](https://developer.salesforce.com/docs/commerce/commerce-api/guide/base-url.html#instance-id).
    
    _Example_
    
    ```
    f_ecom_zzxy_prd
    ```
    
*   `merchantId` (path, string, required) The merchant ID of the requested gift certificate.  
    Minimum length: 1.
*   `siteId` (query, SiteId, required) The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
    
    _Example: SiteId_
    
    ```
    RefArch
    ```
    

#### Responses

*   **204** Successfully deleted the gift certificate information for the specified merchant ID.

### PATCH Update gift certificate information for a specified merchant ID.

`PATCH /organizations/{organizationId}/gift-certificates/{merchantId}`

Operation ID: `updateGiftCertificate`. Security: AmOAuth2 (sfcc.gift-certificates.rw).

#### Parameters

*   `organizationId` (path, OrganizationId, required) An identifier for the Salesforce Commerce Cloud organization the request is being made by. It consists of a prefix 'f\_ecom\_' followed by a 4-character [realm identifier](https://developer.salesforce.com/docs/commerce/commerce-api/guide/base-url.html#realm-id) and a 3-character [instance type identifier](https://developer.salesforce.com/docs/commerce/commerce-api/guide/base-url.html#instance-id).
    
    _Example_
    
    ```
    f_ecom_zzxy_prd
    ```
    
*   `merchantId` (path, string, required) The merchant ID of the requested gift certificate.  
    Minimum length: 1.
*   `siteId` (query, SiteId, required) The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
    
    _Example: SiteId_
    
    ```
    RefArch
    ```
    

#### Request body (required)

Media type: `application/json`. Schema: `GiftCertificate`.

_Example: Gift-Certificates_

```
{
  "description": "Birthday Gift",
  "enabled": false,
  "message": "A birthday gift for you",
  "recipientEmail": "john.doe@gmail.com",
  "recipientName": "John Doe",
  "senderName": "Jane Doe",
  "status": "pending"
}
```

#### Responses

*   **200** Successfully updated the gift certificate information for the specified merchant ID.
    
    Media type: `application/json`. Schema: `GiftCertificate`.
    
    _Example: updateGiftCertificateSuccess_
    
    ```
    {
      "amount": {
        "currencyMnemonic": "USD",
        "value": 100
      },
      "balance": {
        "currencyMnemonic": "USD",
        "value": 100
      },
      "creationDate": "2015-07-31T15:05:52.311Z",
      "description": "Birthday Gift",
      "enabled": false,
      "maskedGiftCertificateCode": "***********cate",
      "merchantId": "NorthernTrailOutfitters",
      "message": "A birthday gift for you",
      "orderNo": "CA17293",
      "recipientEmail": "john.doe@gmail.com",
      "recipientName": "John Doe",
      "senderName": "Jane Doe",
      "status": "pending",
      "transactions": [
        {
          "amount": {
            "currencyMnemonic": "EUR",
            "value": 80
          },
          "orderNo": "CA17293",
          "timestamp": "2015-09-09T17:16:12.066Z",
          "typeCode": "create"
        }
      ]
    }
    ```
    
*   **400**
    
    Potential reasons:
    
    *   Returned when the recipient email address is invalid.
    *   Returned when the specified gift certificate status is invalid.
    
    Media type: `application/json`. Schema: `ErrorResponse`.
    
    _Example InvalidRecipientEmail400: same as PUT /organizations/{organizationId}/gift-certificates 400 response._
    
    _Example InvalidStatus400: same as PUT /organizations/{organizationId}/gift-certificates 400 response._
    
*   **404** Returned when the gift certificate does not exist or does not match the specified merchant ID.
    
    Media type: `application/json`. Schema: `ErrorResponse`.
    
    _Example createGiftCertificate404: same as PUT /organizations/{organizationId}/gift-certificates 404 response._
    

## Schemas

### OrganizationId

An identifier for the Salesforce Commerce Cloud organization the request is being made by. It consists of a prefix 'f\_ecom\_' followed by a 4-character [realm identifier](https://developer.salesforce.com/docs/commerce/commerce-api/guide/base-url.html#realm-id) and a 3-character [instance type identifier](https://developer.salesforce.com/docs/commerce/commerce-api/guide/base-url.html#instance-id).

Type: `string`.

Pattern: ^f\_ecom\_\[a-z\]{4}\_(prd|stg|dev|s\[0-9\]{2}|\[0-9\]{3})$. Example: `f_ecom_zzxy_prd`.

### SiteId

The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites

Type: `string`.

Minimum length: 1. Maximum length: 32. Example: `RefArch`.

### GiftCertificate

Document representing a gift certificate.

*   `amount` (_object_) The gift certificate amount. The user cannot change the gift certificate amount after the creation of the gift certificate.
    
    Includes all fields of `Money`.
    
*   `balance` (_object_) The gift certificate balance. This is a computed attribute and cannot be modified.
    
    Includes all fields of `Money`.
    
*   `creationDate` (_string (date-time)_) Returns the value of attribute 'creationDate'.  
    Example: `1578516896.641`.
*   `description` (_string_) The description of the gift certificate.  
    Maximum length: 4000. Example: `A gift certificate for birthday.` .
*   `enabled` (_boolean_) The enabled flag of the gift certificate.  
    Example: `true`.
*   `lastModified` (_string (date-time)_) Returns the value of attribute 'lastModified'.  
    Example: `1578516896.641`.
*   `maskedGiftCertificateCode` (_string_) Masked code.  
    Example: `*******XQTY`.
*   `merchantId` (_string_) The merchant ID of the gift certificate. This is a unique attribute. This is a computed attribute and cannot be modified. This is used to get, update and the delete gift certificates.  
    Example: `Macy's1256489` .
*   `message` (_string_) The message to the recipient of the gift certificate.  
    Maximum length: 4000. Example: `This gift certificate is to be given as birthday present` .
*   `orderNo` (_string_) The order number of the gift certificate.  
    Example: `MyOrder5421` .
*   `recipientEmail` (_string_) The email address of the recipient of the gift certificate.  
    Example: `my-recipient-email@gmail.com` .
*   `recipientName` (_string_) The recipient of the gift certificate.  
    Maximum length: 256. Example: `Jane Doe` .
*   `senderName` (_string_) The sender of the gift certificate.  
    Maximum length: 256. Example: `John Smith` .
*   `status` (_string_) The status of the gift certificate. While creating a gift certificate, user can set the status to either "pending" or "issued" only.  
    Allowed values: `issued`, `partially_redeemed`, `pending`, `redeemed`. Example: `issued`.
*   `transactions` (_array of AccountTransaction_) The transactions of the gift certificate.
    
    _Example_
    
    ```
    [
      {
        "amount": {
          "currencyMnemonic": "USD",
          "value": 1000
        },
        "orderNo": "my-test-order_no",
        "timestamp": "2020-01-08T20:54:56.644Z",
        "typeCode": "create"
      }
    ]
    ```
    

### ErrorResponse

*   `title` (_string_, required) A short, human-readable summary of the problem type. It will not change from occurrence to occurrence of the problem, except for purposes of localization  
    Maximum length: 256. Example: `You do not have enough credit`.
*   `type` (_string_, required) A URI reference \[RFC3986\] that identifies the problem type. This specification encourages that, when dereferenced, it provide human-readable documentation for the problem type (e.g., using HTML \[W3C.REC-html5-20141028\]). When this member is not present, its value is assumed to be "about:blank". It accepts relative URIs; this means that they must be resolved relative to the document's base URI, as per \[RFC3986\], Section 5.  
    Maximum length: 2048. Example: `NotEnoughMoney`.
*   `detail` (_string_, required) A human-readable explanation specific to this occurrence of the problem.  
    Example: `Your current balance is 30, but that costs 50`.
*   `instance` (_string_) A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. It accepts relative URIs; this means that they must be resolved relative to the document's base URI, as per \[RFC3986\], Section 5.  
    Maximum length: 2048. Example: `/account/12345/msgs/abc`.

### SearchRequest

Document representing a search request for retrieving items within the Data API. The query is a potentially complex set of expressions. The fields and expands that each query supports are defined within the search resource.

*   `limit` (_integer (int32)_) Maximum records to retrieve per request, not to exceed 200.  
    Minimum: 1. Maximum: 200. Example: `10`.
*   `query` (_Query_, required)
*   `sorts` (_array of Sort_) The list of sort clauses configured for the search request. Sort clauses are optional. See the description of the search endpoint for details on the default sorting behavior that is used when explicit sorts are not passed.
*   `offset` (_Offset_)

### GiftCertificateSearchResult

Document representing a gift certificate search result.

Includes all fields of `PaginatedSearchResult`.

*   `hits` (_array of GiftCertificate_, required)

### Money

A combination of a Currency and an amount of that Currency.

*   `currencyMnemonic` (_CurrencyCode_)
*   `value` (_number (double)_) The amount of money for the given currency.  
    Example: `1234.56`.

### AccountTransaction

Document representing an account transaction.

*   `amount` (_Money_, required)
*   `orderNo` (_string_, required) The order number of the gift certificate.  
    Example: `my-order-43128`.
*   `timestamp` (_string (date-time)_, required) The timestamp of the transaction of the gift certificate.  
    Example: `1578516896.641`.
*   `typeCode` (_string_, required) The type code of the gift certificate.  
    Allowed values: `create`, `redeem`, `delete`, `enable`, `disable`. Example: `redeem`.

### Query

A set of objects that define criteria used to select records. A query can contain one of the following:

*   `MatchAllQuery`

*   Matches all documents.

*   `TermQuery`

*   Matches one or more documents against one or more document fields.

*   `TextQuery`

*   Matches text against one or more fields.

*   `BoolQuery`

*   Allows construction of a logical expression of multiple queries.

*   `FilteredQuery`

*   Allows a filter to be applied to a query.

*   `NestedQuery`

*   Allows you to query on nested documents.
*   _Only supported by some Commerce APIs. For more details, see the endpoint descriptions in the API documentation._

Minimum properties: 1. Maximum properties: 1.

*   `boolQuery` (_BoolQuery_)
*   `filteredQuery` (_FilteredQuery_)
*   `matchAllQuery` (_MatchAllQuery_)
*   `nestedQuery` (_NestedQuery_)
*   `termQuery` (_TermQuery_)
*   `textQuery` (_TextQuery_)

_Example_

```
{
  "filteredQuery": {
    "query": {
      "textQuery": {
        "fields": [
          "couponId"
        ],
        "searchPhrase": "disabled"
      }
    },
    "filter": {
      "termFilter": {
        "field": "enabled",
        "operator": "is",
        "values": [
          false
        ]
      }
    }
  }
}
```

### Sort

Document representing a sort request. Each API has a different default sort configuration that can be modified in the request.

*   `field` (_string_, required) The name of the field to sort on.  
    Maximum length: 256. Example: `couponId`.
*   `sortOrder` (_string_) The sort order to be applied when sorting. When omitted, the default sort order (asc) is used.  
    Allowed values: `asc`, `desc`. Default: `asc`. Example: `asc`.

_Example_

```
{
  "field": "couponId",
  "sortOrder": "desc"
}
```

### Offset

The zero-based index of the first hit/data to include in the result.

Type: `integer (int32)`.

Default: `0`. Minimum: 0. Example: `0`.

### PaginatedSearchResult

Document representing a generic search result. Each search resource should extend this to define what is returned in the `hits`.

Includes all fields of `PaginatedResultBase`.

*   `query` (_Query_, required)
*   `sorts` (_array of Sort_) The sorting that was applied to the result.
*   `hits` (_array of object_) The sorted array of search hits. Can be empty.

_Example_

```
{
  "limit": 1,
  "hits": [
    {
      "couponId": "coupon1",
      "creationDate": "2019-10-20T12:00:00Z",
      "description": "This coupon is used to give 10% off stuff.",
      "enabled": false,
      "exportedCodeCount": 0,
      "lastModified": "2019-10-30T04:23:59Z",
      "redemptionCount": 3,
      "redemptionLimits": {
        "limitPerCode": 1,
        "limitPerCustomer": 1,
        "limitPerTimeFrame": {
          "limit": 2,
          "redemptionTimeFrame": 24
        }
      },
      "singleCode": "MyCode",
      "systemCodesConfig": {
        "codePrefix": "SG",
        "numberOfCodes": 500000
      },
      "totalCodesCount": 50,
      "type": "single_code"
    }
  ],
  "query": {
    "textQuery": {
      "fields": [
        "id",
        "description"
      ],
      "searchPhrase": "stuff"
    }
  },
  "sorts": [
    {
      "field": "couponId",
      "sortOrder": "desc"
    }
  ],
  "offset": 2,
  "total": 8
}
```

### CurrencyCode

A three letter uppercase currency code conforming to the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) standard, or the string `N/A` indicating that a currency is not applicable.

Type: `string`.

Pattern: ^(\[A-Z\]\[A-Z\]\[A-Z\]|N/A)$. Example: `USD`.

### BoolQuery

A boolean query allows construction of full logical expression trees that are composed of other queries (usually term queries and text queries). A boolean query has three sets of clauses:

*   `must`, which combines as an `AND` operator.
*   `should`, which combines as an `OR` operator.
*   `must_not`, which combines as a `NOT` operator.

If `must`, `mustNot`, or `should` appear in the same boolean query, they are combined logically using the `AND` operator. For example:

```
(must-1 AND must-1 AND ...)
  AND (should-1 OR should-2 OR ...)
  AND NOT (must_not-1 OR must_not-2 OR ...)
```

*   `must` (_array of Query_) List of queries to be evaluated as an `AND` operator.
*   `mustNot` (_array of Query_) List of queries to be evaluated as a `NOT` operator.
*   `should` (_array of Query_) List of queries to be evaluated as an `OR` operator.

_Example_

```
{
  "must": [
    {
      "textQuery": {
        "fields": [
          "couponId"
        ],
        "searchPhrase": "DEAL"
      }
    },
    {
      "textQuery": {
        "fields": [
          "description"
        ],
        "searchPhrase": "Big bargain deal"
      }
    }
  ],
  "mustNot": [
    {
      "termQuery": {
        "fields": [
          "enabled"
        ],
        "operator": "is",
        "values": [
          false
        ]
      }
    }
  ]
}
```

### FilteredQuery

Allows to filter the result of a possibly complex query using a possibly complex filter.

*   `filter` (_Filter_, required)
*   `query` (_Query_, required)

_Example_

```
{
  "query": {
    "textQuery": {
      "fields": [
        "couponId"
      ],
      "searchPhrase": "disabled"
    }
  },
  "filter": {
    "termFilter": {
      "field": "enabled",
      "operator": "is",
      "values": [
        false
      ]
    }
  }
}
```

### MatchAllQuery

Matches all documents (namespace and document type). This query comes in handy if you just want to filter a search result or really do not have any constraints.

### NestedQuery

Allows you to query nested documents that are part of a larger document. Say, for example, that you have a main product with variations in one big document, and you want to constrain a search to main products that have variations that match multiple constraints.

A `NestedQuery` is only supported by some Commerce APIs. For more details, see the endpoint descriptions in the API documentation.

*   `path` (_string_, required) The path to the nested document.  
    Maximum length: 2048. Example: `order.shippingAddresses`.
*   `query` (_Query_, required)
*   `scoreMode` (_string_) Indicates how scores for matching child objects affect the root parent document’s relevance score.  
    Allowed values: `avg`, `total`, `max`, `none`. Example: `avg`.

_Example_

```
{
  "path": "order.shippingAddresses",
  "query": {
    "boolQuery": {
      "must": [
        {
          "boolQuery": {
            "must": [
              {
                "termQuery": {
                  "fields": [
                    "order.shippingAddresses.firstName"
                  ],
                  "operator": "is",
                  "values": [
                    "John"
                  ]
                }
              }
            ]
          }
        },
        {
          "boolQuery": {
            "must": [
              {
                "termQuery": {
                  "fields": [
                    "order.shippingAddresses.lastName"
                  ],
                  "operator": "is",
                  "values": [
                    "Doe"
                  ]
                }
              }
            ]
          }
        }
      ]
    }
  },
  "scoreMode": "avg"
}
```

### TermQuery

A term query matches one or more values against one or more document fields. A document is considered a hit if one of the values matches exactly with at least one of the given fields. The operator `is` can only take one value, while `one_of` can take multiple values. If multiple fields are specified, they are combined using a logical `OR` operator.

**Limitations:**

*   The `greater` and `less` operators are not supported under certain conditions. Both operators are permitted unless the API documentation states otherwise.
*   A subset of Commerce APIs handle queries with multiple fields differently. If the query has multiple fields, the query is internally handled as a logical `OR` of `DisjointMaxQueries` (with the dismax matching a value against all fields). The dismax makes sure that a document carrying a single term in multiple fields does not get higher scores than a document matching multiple terms in multiple fields.

*   `fields` (_array of Field_, required) The document fields that the values are matched against, combined with the operator.  
    Minimum items: 1.
*   `operator` (_string_, required) Returns the operator to use for the term query.  
    Allowed values: `is`, `one_of`, `is_null`, `is_not_null`, `less`, `greater`, `not_in`, `neq`. Example: `is`.
*   `values` (_array of string | number | boolean | integer_) The values that the fields are compared against, combined with the operator.  
    Items: Example: `myCouponId`.

### TextQuery

A text query is used to match some text (for example, a search phrase possibly consisting of multiple terms) against one or more fields. When multiple fields are provided, the phrase conceptually forms a logical `OR` over the fields. In this case, the terms of the phrase basically have to match within the text, that would result in concatenating all given fields.

*   `fields` (_array of Field_, required) The document fields that the search phrase matches against.  
    Minimum items: 1.
*   `searchPhrase` (_string_, required) A search phrase, which can include multiple terms separated by spaces.  
    Example: `campaign summer`.

_Example_

```
{
  "fields": [
    "couponId"
  ],
  "searchPhrase": "limit"
}
```

### PaginatedResultBase

Schema defining generic pageable result. Each response schema of a resource requiring pagination should extend this schema. If you use this extend this schema directly, it needs to be defined what data is returned. Allowed names for the data field is `data`.

Includes all fields of `ResultBase`.

*   `offset` (_Offset_, required)

### Filter

Contains a set of objects that define criteria used to select records. A filter can contain one of the following:

*   `TermFilter`

*   Matches records where a field (or fields) exactly matches some simple value (including `null`).

*   `RangeFilter`

*   Matches records where a field value lies within a specified range.

*   `Range2Filter`

*   Matches records in a specified range across fields.

*   `QueryFilter`

*   Matches records based on a query.

*   `BoolFilter`

*   Provides filtering of records using a set of filters combined using a logical operator.

Minimum properties: 1. Maximum properties: 1.

*   `boolFilter` (_BoolFilter_)
*   `queryFilter` (_QueryFilter_)
*   `range2Filter` (_Range2Filter_)
*   `rangeFilter` (_RangeFilter_)
*   `termFilter` (_TermFilter_)

### Field

Name of the field. Might be a custom field name prefixed with c\_.

Type: `string`.

Maximum length: 260. Example: `couponId`.

### ResultBase

Schema defining generic list result. Each response schema of a resource requiring a list response should extend this schema. Additionally it needs to be defined what data is returned.

*   `limit` (_integer (int32)_, required) Maximum records to retrieve per request. The limit with its constraints (minimum, maximum, default) is defined by the request parameter `limit` of the endpoint returning this schema.  
    Example: `10`.
*   `total` (_Total_, required)

### BoolFilter

Allows you to combine other filters into (possibly recursive) logical expression trees. A boolean filter is composed of a logical operator (`AND`, `OR`, `NOT`) and a list of filters that the operator relates to. Multiple filters can be negated with a single `NOT` operator, even when the filters are combined with the `AND` operator.

*   `filters` (_array of Filter_) A list of filters that are logically combined by an operator.
*   `operator` (_string_, required) The logical operator that is used to combine the filters.  
    Allowed values: `and`, `or`, `not`. Example: `and`.

_Example_

```
{
  "operator": "and",
  "filters": [
    {
      "termFilter": {
        "field": "id",
        "operator": "is",
        "values": [
          "myId"
        ]
      }
    },
    {
      "termFilter": {
        "field": "couponId",
        "operator": "is",
        "values": [
          "couponOne"
        ]
      }
    }
  ]
}
```

### QueryFilter

Wraps any query and allows it to be used as a filter.

*   `query` (_Query_, required)

### Range2Filter

Allows you to restrict a search result to hits where a range defined by specified attributes has a certain relationship to a specified range.

The first range (R1) is defined by a pair of attributes (`fromField` and `toField`) that specify the extent of a range, such as attributes `validFrom` and `validTo`.

The second range (R2) is defined by `fromValue` and `toValue`.

The filter mode specifies the method used to compare the two ranges:

*   `overlap`: R1 overlaps fully or partially with R2.
*   `containing`: R1 contains R2.
*   `contained`: R1 is contained in R2.

The range filter supports several value types, and relies on the natural sorting of the value type for range interpretation. Value ranges can be open-ended, but only at one end of the range. You can configure whether the lower bounds and upper bounds are inclusive or exclusive.

A range 2 filter is useful for general restrictions that can be shared between searches (like a static date range) because the filter result is cached in memory. Range filters are not appropriate if the range is expected to be different for every query (for example, if the user controls the date range down to the hour via a UI control). Range filters are inclusive by default.

*   `filterMode` (_string_) Compare mode: overlap, containing, or contained.  
    Allowed values: `overlap`, `containing`, `contained`. Default: `overlap`. Example: `overlap`.
*   `fromField` (_object_, required) The field name of the field that starts the first range.  
    Example: `validFrom`.
    
    Includes all fields of `Field`.
    
    Example: `validFrom`.
    
*   `fromInclusive` (_boolean_) A flag indicating if the lower bound of the second range is inclusive. To make the lower bound exclusive, set to `false`.  
    Default: `true`. Example: `true`.
*   `fromValue` (_any_) The lower bound of the second range. If not specified, the range is open-ended with respect to the lower bound. You can't leave both the lower and upper bounds open-ended.  
    Example: `2007-01-01T00:00:00.000Z`.
*   `toField` (_object_, required) The field name of the field that ends the first range.  
    Example: `validTo`.
    
    Includes all fields of `Field`.
    
    Example: `validTo`.
    
*   `toInclusive` (_boolean_) A flag indicating if the upper bound of the second range is inclusive. To make the lower bound exclusive, set to `false`.  
    Default: `true`. Example: `true`.
*   `toValue` (_any_) The upper bound of the second range. If not specified, the range is open-ended with respect to the upper bound. You can't leave both the upper and lower bounds open-ended.  
    Example: `2017-01-01T00:00:00.000Z`.

_Example_

```
{
  "fromField": "validFrom",
  "toField": "validTo",
  "filterMode": "overlap",
  "fromValue": "2007-01-01T00:00:00.000Z",
  "toValue": "2017-01-01T00:00:00.000Z"
}
```

### RangeFilter

Allows you to restrict a search result to hits that have values for a given attribute that fall within a given value range. The range filter supports several value types and relies on the natural sorting of the value type for range interpretation. Value ranges can be open-ended, but only at one end of the range. You can configure whether the lower bounds and upper bounds are inclusive or exclusive.

A range filter is useful for general restrictions that can be shared between searches (like a static date range) because the filter result is cached in memory. Range filters are not appropriate if the range is expected to be different for every query (for example, if the user controls the date range down to the hour via a UI control). Range filters are inclusive by default.

*   `field` (_object_, required) The search field.  
    Example: `validFrom`.
    
    Includes all fields of `Field`.
    
    Example: `validFrom`.
    
*   `from` (_string (date-time) | integer | number_) The lower bound of the filter range. If not specified, the range is open-ended with respect to the lower bound. You can't leave both the lower and upper bounds open-ended.
    
    One of: `string (date-time)`, `integer`, `number`.
    
    *   _string (date-time)_
        
        Type: `string (date-time)`.
        
        Example: `2007-01-01T00:00:00.000Z`.
        
    *   _integer_
        
        Type: `integer`.
        
        Example: `1`.
        
    *   _number_
        
        Type: `number`.
        
        Example: `1`.
        
*   `fromInclusive` (_boolean_) A flag indicating if the lower bound of the range is inclusive. To make the lower bound exclusive, set to `false`.  
    Default: `true`. Example: `true`.
*   `to` (_string (date-time) | integer | number_) The upper bound of the filter range. If not specified, the range is open-ended with respect to the upper bound. You can't leave both the upper and lower bounds open-ended.
    
    One of: `string (date-time)`, `integer`, `number`.
    
    *   _string (date-time)_
        
        Type: `string (date-time)`.
        
        Example: `2007-01-02T00:00:00.000Z`.
        
    *   _integer_
        
        Type: `integer`.
        
        Example: `2`.
        
    *   _number_
        
        Type: `number`.
        
        Example: `2`.
        
*   `toInclusive` (_boolean_) A flag indicating if the upper bound of the range is inclusive. To make the upper bound exclusive, set to `false`.  
    Default: `true`. Example: `true`.

### TermFilter

Allows you to restrict a search result to hits that match exactly one of the values configured for the filter. A term filter is useful for general restrictions that can be shared between searches. Use term filters whenever the criteria you filter on is a shared property of multiple searches (for example, like filtering by an order status). Use term filters for fields that have a discrete and small set of values only.

*   `field` (_object_, required) The filter field.
    
    Includes all fields of `Field`.
    
*   `operator` (_string_, required) The operator used to compare the field's values with the given values.  
    Allowed values: `is`, `one_of`, `is_null`, `is_not_null`, `less`, `greater`, `not_in`, `neq`. Example: `is`.
*   `values` (_array of string_) The filter values.  
    Items: Example: `myId`.

_Example_

```
{
  "field": "id",
  "operator": "is",
  "values": [
    "myId"
  ]
}
```

### Total

The total number of hits that match the search's criteria. This can be greater than the number of results returned as search results are pagenated.

Type: `integer (int32)`.

Default: `0`. Minimum: 0. Example: `10`.