---
title: "Subscribe to a Webhook"
description: >
  Subscribe to a specific Webhook event, such as order creation or order status change. You must supply a URL for your app to receive the event notification.  :::warning **CAUTION**: For Webhook events v20240601 and later, use this API for subscriptions. For managing Webhook events in earlier versions, follow these steps:  - Public and custom apps: Go to **Apps** > **Webhook configuration** in the [SHOPLINE Partner Portal](https://developer.myshopline.com/).  - Private apps: Go to **Apps** > **Develop Apps** > **Edit** > **Permission configuration** in the [SHOPLINE Admin](https://admin.myshopline.com/user/signIn).  :::
doc_type: openapi
doc_category: openapi
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/admin-rest-api/webhook/subscribe-to-a-webhook'
  md: 'https://developer.shopline.com/docs/admin-rest-api/webhook/subscribe-to-a-webhook.md'
---
# Subscribe to a Webhook

Subscribe to a specific Webhook event, such as order creation or order status change. You must supply a URL for your app to receive the event notification. 
:::warning
**CAUTION**: For Webhook events v20240601 and later, use this API for subscriptions. For managing Webhook events in earlier versions, follow these steps: 
- Public and custom apps: Go to **Apps** > **Webhook configuration** in the [SHOPLINE Partner Portal](https://developer.myshopline.com/). 
- Private apps: Go to **Apps** > **Develop Apps** > **Edit** > **Permission configuration** in the [SHOPLINE Admin](https://admin.myshopline.com/user/signIn). 
:::



- **Base URL:** `https://{handle}.myshopline.com/admin/openapi`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** RESTful

## Endpoint

```http
POST /webhooks.json
```

## Base URL

* `https://{handle}.myshopline.com/admin/openapi`

  * `{handle}`: `handle` : The store's unique identifier, which is the prefix of the store's domain name. For example, if a store's domain name is `open001.myshopline.com` , the store handle is `open001` .

## Request

### Request Headers

* `Content-Type`

  string (required)

  The field must be set to the fixed value `application/json; charset=utf-8`.

* `Authorization`

  string (required)

   The access token for the API resource. Refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then pass the obtained token in the Bearer format. 

### Request Body

* `webhook`

  object

  Configuration information for the Webhook event subscription.

  * `address`

    string

    The callback URL to which the event notification is sent when the corresponding event occurs.                
    Maximum length: 255
    

  * `api_version`

    string

    The version of this Webhook subscription API. Only `v20240601` and later versions are supported. 

  * `topic`

    string

    The specific Webhook event to subscribe to, such as `products/create`, which represents the product creation event. 
    For valid event values, refer to the value under **Event Identification** in the table within each [Webhook document](https://developer.shopline.com/docs/webhook/product/product-created.md). 
    

## Response

### Status Codes

* `200`

  For the complete list of codes and messages, see [Http status code](https://developer.shopline.com/docs/apps/api-instructions-for-use/http-status-code.md?lang=en).

* `401`

  

* `429`

  

### Response Headers

* `traceId`

  A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise.

### Response Body

#### 200

* `webhook`

  object

  The Webhook event subscription information. 

  * `address`

    string

    The callback URL to which the event notification is sent when the corresponding event occurs.
    Maximum length: 255

  * `api_version`

    string

    The version of this Webhook subscription API. Only `v20240601` and later versions are supported. 

  * `created_at`

    string

    The date and time when the Webhook event was successfully subscribed for the first time. Format: [ISO 8601. ](https://www.iso.org/iso-8601-date-and-time-format.html)
    

  * `id`

    integer

    A unique identifier for the Webhook subscription record. 

  * `topic`

    string

    The specific event successfully subscribed to, such as `products/create`, which represents the product creation event.

  * `updated_at`

    string

    The date and time when the Webhook subscription record was last updated. Format: [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). 
    


#### 401

* `errors`

  string

  Error message. 


#### 429

* `errors`

  string

  Error message. 


## OpenAPI Definition

```json
{
  "tags": [
    "Subscribe to a Webhook"
  ],
  "description": "Subscribe to a specific Webhook event, such as order creation or order status change. You must supply a URL for your app to receive the event notification. \n:::warning\n**CAUTION**: For Webhook events v20240601 and later, use this API for subscriptions. For managing Webhook events in earlier versions, follow these steps: \n- Public and custom apps: Go to **Apps** > **Webhook configuration** in the [SHOPLINE Partner Portal](https://developer.myshopline.com/). \n- Private apps: Go to **Apps** > **Develop Apps** > **Edit** > **Permission configuration** in the [SHOPLINE Admin](https://admin.myshopline.com/user/signIn). \n:::\n\n",
  "operationId": "5yxG7lOk",
  "parameters": [
    {
      "name": "Content-Type",
      "in": "header",
      "description": "The field must be set to the fixed value `application/json; charset=utf-8`.",
      "required": true,
      "schema": {
        "name": "Content-Type",
        "type": "string",
        "example": "application/json; charset=utf-8"
      }
    },
    {
      "name": "Authorization",
      "in": "header",
      "description": " The access token for the API resource. Refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then pass the obtained token in the Bearer format. ",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Authorization",
        "description": " The access token for the API resource. Refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then pass the obtained token in the Bearer format. ",
        "type": "string",
        "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
      },
      "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "name": "body",
          "description": "Body location parameters",
          "type": "object",
          "properties": {
            "webhook": {
              "name": "webhook",
              "description": "Configuration information for the Webhook event subscription.",
              "type": "object",
              "properties": {
                "address": {
                  "name": "address",
                  "description": "The callback URL to which the event notification is sent when the corresponding event occurs.                \nMaximum length: 255\n",
                  "type": "string",
                  "example": "https://www.shopline.com/webhook"
                },
                "api_version": {
                  "name": "api_version",
                  "description": "The version of this Webhook subscription API. Only `v20240601` and later versions are supported. ",
                  "type": "string",
                  "example": "v20240601"
                },
                "topic": {
                  "name": "topic",
                  "description": "The specific Webhook event to subscribe to, such as `products/create`, which represents the product creation event. \nFor valid event values, refer to the value under **Event Identification** in the table within each [Webhook document](https://developer.shopline.com/docs/webhook/product/product-created.md). \n",
                  "type": "string",
                  "example": "products/create"
                }
              },
              "required": [
                "address",
                "api_version",
                "topic"
              ],
              "example": {
                "address": "https://www.shopline.com/webhook",
                "api_version": "v20240601",
                "topic": "products/create"
              }
            }
          },
          "required": [
            "webhook"
          ],
          "example": {
            "webhook": {
              "address": "https://www.shopline.com/webhook",
              "api_version": "v20240601",
              "topic": "products/create"
            }
          }
        },
        "examples": {
          "Subscribe to the product creation Webhook": {
            "description": "This example demonstrates how to subscribe to the \"product creation\" event.",
            "value": {
              "webhook": {
                "address": "https://www.shopline.com/webhook",
                "api_version": "v20240601",
                "topic": "collect/delete"
              }
            }
          }
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "description": "For the complete list of codes and messages, see [Http status code](https://developer.shopline.com/docs/apps/api-instructions-for-use/http-status-code.md?lang=en).",
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "name": "body",
            "type": "object",
            "properties": {
              "webhook": {
                "name": "webhook",
                "description": "The Webhook event subscription information. ",
                "type": "object",
                "properties": {
                  "address": {
                    "name": "address",
                    "description": "The callback URL to which the event notification is sent when the corresponding event occurs.\nMaximum length: 255",
                    "type": "string",
                    "example": "https://www.shopline.com/webhook"
                  },
                  "api_version": {
                    "name": "api_version",
                    "description": "The version of this Webhook subscription API. Only `v20240601` and later versions are supported. ",
                    "type": "string",
                    "example": "v20240601"
                  },
                  "created_at": {
                    "name": "created_at",
                    "description": "The date and time when the Webhook event was successfully subscribed for the first time. Format: [ISO 8601. ](https://www.iso.org/iso-8601-date-and-time-format.html)\n",
                    "type": "string",
                    "example": "2024-01-31T18:21:06+08:00"
                  },
                  "id": {
                    "name": "id",
                    "description": "A unique identifier for the Webhook subscription record. ",
                    "type": "integer",
                    "example": 13814
                  },
                  "topic": {
                    "name": "topic",
                    "description": "The specific event successfully subscribed to, such as `products/create`, which represents the product creation event.",
                    "type": "string"
                  },
                  "updated_at": {
                    "name": "updated_at",
                    "description": "The date and time when the Webhook subscription record was last updated. Format: [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). \n",
                    "type": "string",
                    "example": "2024-01-31T18:21:06+08:00"
                  }
                },
                "example": {
                  "address": "https://www.shopline.com/webhook",
                  "api_version": "v20240601",
                  "created_at": "2024-01-31T18:21:06+08:00",
                  "id": 13814,
                  "topic": null,
                  "updated_at": "2024-01-31T18:21:06+08:00"
                }
              }
            },
            "example": {
              "webhook": {
                "address": "https://www.shopline.com/webhook",
                "api_version": "v20240601",
                "created_at": "2024-01-31T18:21:06+08:00",
                "id": 13814,
                "topic": null,
                "updated_at": "2024-01-31T18:21:06+08:00"
              }
            }
          },
          "examples": {
            "Subscribe to the product creation Webhook": {
              "description": "This example demonstrates how to subscribe to the \"product creation\" event.",
              "value": {
                "webhook": {
                  "address": "https://www.shopline.com/webhook",
                  "api_version": "v20240601",
                  "created_at": "2025-02-13T17:01:29+08:00",
                  "id": 45852,
                  "topic": "collect/delete",
                  "updated_at": "2025-02-13T17:01:32+08:00"
                }
              }
            }
          }
        }
      }
    },
    "401": {
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "Error message. ",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    },
    "429": {
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "Error message. ",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    }
  },
  "security": [
    {
      "oauth2": []
    }
  ],
  "method": "post",
  "path": "/webhooks.json",
  "servers": [
    {
      "url": "https://{handle}.myshopline.com/admin/openapi",
      "variables": {
        "handle": {
          "default": "openapiceshidianpu",
          "description": "`handle` : The store's unique identifier, which is the prefix of the store's domain name. For example, if a store's domain name is `open001.myshopline.com` , the store handle is `open001` ."
        }
      }
    }
  ],
  "info": {
    "title": "Subscribe to a Webhook",
    "version": "v20270301"
  }
}
```