# Webhook

```
//
You can register webhook for tracking with this endpoint. 

Our API only supports :
  - Content-Type : application/json


```

<mark style="color:green;">`POST`</mark> `https://api.printway.io/cdn/api/webhook/v1/register`

#### Headers

| Name                                              | Type   | Description      |
| ------------------------------------------------- | ------ | ---------------- |
| PW-ACCESS-TOKEN<mark style="color:red;">\*</mark> | String | The Access Token |

#### Request Body

| Name                                       | Type       | Description                                                                                                                 |
| ------------------------------------------ | ---------- | --------------------------------------------------------------------------------------------------------------------------- |
| type<mark style="color:red;">\*</mark>     | String     | <p>list:  Get Webhook information registered</p><p>create: Register new webhook</p><p>update: Update webhook registered</p> |
| endpoint<mark style="color:red;">\*</mark> | String URL | Your endpoint for us to send tracking when available (Required with type: create)                                           |
| status                                     | Number     | <p>0: Inactive</p><p>1: Active</p><p>Default: 1</p>                                                                         |
| access\_token                              | String     | Your access token (Optional)                                                                                                |
| access\_key                                | String     | Your Access Key (Optional)                                                                                                  |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
   "status": 200,
   "message": "Registered webhook successfully!",
   "endpoint": "https://api.printway.io/webhook/send-tracking",
   "access_key": "",
   "access_token": "",
   "status": "Active", // - Inactive
   "request_body": {
      "order_id": "--- Your Order ID ---",
      "tracking_number": "--- Tracking Number ---",
      "tracking_url": "--- Tracking Url ---"
   },
   "request_header": {
      "Content-Type": "application/json",
      "--- Your Access key ---" : "----- Your access token registered -----"
   }
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    "status": 401,
    "message": "Not authenticated"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

<pre class="language-javascript"><code class="lang-javascript"><strong>{
</strong>    "status": 400,
    "message": "Not found! No registered webhook."
}
</code></pre>

{% endtab %}
{% endtabs %}

```
// This is my request body send via webhook

{
    "order_id": "abcdf121323",
    "tracking_number": "45121646131321321313163",
    "tracking_url": "https://..."
}

```
