ResourcesCoupons

Update a coupon

This endpoint allows you to perform an update on a coupon.

This endpoint allows you to perform an update on a coupon.

To scope a coupon, set store_wide to false, send product/listing IDs in products, and optionally send variant IDs in product_variants. Every variant must belong to one of the selected products.

Omitting product_variants preserves existing variant restrictions. Sending an empty product_variants array clears the restrictions, making every variant of the selected products eligible. Changing products automatically removes restrictions for products that are no longer selected.

PATCH
/v1/coupons/{coupon}

Authorization

bearerAuth storeAuth
AuthorizationBearer <token>

Provide your SellApp API key as a bearer token.

In: header

X-STORE<token>

Select the SellApp store for this API request.

In: header

Path Parameters

coupon*integer

The coupon path parameter.

Query Parameters

with_trashed?boolean

Include soft-deleted resources in the result.

Defaultfalse
only_trashed?boolean

Return only soft-deleted resources. Ignored when with_trashed is true.

Defaultfalse

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X PATCH "https://sell.app/api/v1/coupons/0" \  -H "Content-Type: application/json" \  -d '{    "store_wide": false,    "products": [      123    ],    "product_variants": [      1001,      1002    ]  }'
{
  "data": {
    "id": 1,
    "code": "BAZINGA",
    "type": "PERCENTAGE",
    "discount": "80",
    "limit": null,
    "store_wide": true,
    "minimum_amount": null,
    "expires_at": null,
    "created_at": "2022-12-12T12:12:12.000000Z",
    "updated_at": "2022-12-12T12:12:12.000000Z",
    "store_id": 1,
    "deleted_at": null,
    "products": [],
    "product_variants": [],
    "maximum_discount_amount": null
  }
}
{
  "message": "Unauthenticated."
}
{
  "message": "This action is unauthorized."
}
{
  "message": "Rule not found."
}
{
  "message": "The given data was invalid.",
  "errors": {
    "data": [
      "The data field is required."
    ]
  }
}
PUT
/v1/coupons/{coupon}

Authorization

bearerAuth storeAuth
AuthorizationBearer <token>

Provide your SellApp API key as a bearer token.

In: header

X-STORE<token>

Select the SellApp store for this API request.

In: header

Path Parameters

coupon*integer

The coupon path parameter.

Query Parameters

with_trashed?boolean

Include soft-deleted resources in the result.

Defaultfalse
only_trashed?boolean

Return only soft-deleted resources. Ignored when with_trashed is true.

Defaultfalse

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X PUT "https://sell.app/api/v1/coupons/0" \  -H "Content-Type: application/json" \  -d '{    "store_wide": false,    "products": [      123    ],    "product_variants": [      1001,      1002    ]  }'
{
  "data": {
    "id": 1,
    "code": "BAZINGA",
    "type": "PERCENTAGE",
    "discount": "80",
    "limit": null,
    "store_wide": true,
    "minimum_amount": null,
    "expires_at": null,
    "created_at": "2022-12-12T12:12:12.000000Z",
    "updated_at": "2022-12-12T12:12:12.000000Z",
    "store_id": 1,
    "deleted_at": null,
    "products": [],
    "product_variants": [],
    "maximum_discount_amount": null
  }
}
{
  "message": "Unauthenticated."
}
{
  "message": "This action is unauthorized."
}
{
  "message": "Rule not found."
}
{
  "message": "The given data was invalid.",
  "errors": {
    "data": [
      "The data field is required."
    ]
  }
}