Update webhook responses

Possible responses when updating a webhook:

Status Meaning Description  
  200 OK Webhook updated successfully. The API returns the full updated webhook. Header values are always masked.
  401 Unauthorized The API returns this when the API key given doesn’t match a valid merchant account.
  403 Forbidden The API returns this when the API secret doesn’t have the required permission.
  404 Not Found The API returns this when it couldn’t find the given publishable_id.
  422 Unprocessable Entity Returned when validation fails. Only fields present in the request are validated.

To perform this operation, authenticate with an authentication token.

Examples

Successful update webhook response

{
  "response": {
    "publishable_id": "twhs_abc123xyz",
    "webhook_url": "https://new.example.com/hook",
    "enabled_states": ["in_transit", "completed", "delivery_attempted"],
    "hide_delivery_address": false,
    "hide_receiver_details": false,
    "enabled": true,
    "headers": [
      { "key": "X-New-Token", "value": "*****" }
    ]
  }
}

Custom header values are always masked (*****) in all responses—they’re write-only.

Failed update webhook responses

Returned when validation fails. All validation errors follow the same shape:

{
  "error": "invalid_resource",
  "error_description": "<message>"
}
Trigger Error Description
Merchant already has 6 webhooks Maximum number of webhooks reached.
Webhook URL is blank or doesn’t start with http(s):// Please enter a valid URL starting with http:// or https://
Webhook URL exceeds 2048 characters Webhook URL must not exceed 2048 characters.
Enabled states is empty Add minimum one enabled state.
Enabled states contains unknown values One or more enabled states are invalid.
More than 6 headers provided You can add up to 6 custom headers.
A header key is blank or contains whitespace Please enter a valid key without whitespaces
A header value is blank Header value can’t be empty.
Duplicate header key Header key can’t be duplicated.

The API returns this when it couldn’t find the given publishable_id:

{
  "error": "not_found",
  "error_description": "The requested resource could not be found."
}

Unknown error occurs

Shippit may return this if it has trouble with the combination of the input or merchant account configuration.

{
  "error": "system",
  "error_description": "An unknown error has occurred."
}