iQ Suite - Docs

Create Webhook

Create a new webhook for receiving asynchronous event notifications.

Description

The Create Webhook endpoint allows you to set up a webhook that listens for specific events and sends notifications to your specified URL. Webhooks are useful for integrating real-time event data into your applications.

HTTP Request

POST /webhooks

Authentication

All requests must include an Authorization header with a valid API key.

Headers

KeyValue
AuthorizationBearer YOUR_API_KEY
Content-Typeapplication/json

Request Body

  • url: The URL where the webhook notifications will be sent.
  • name: A descriptive name for the webhook.
  • secret: A secret key to secure webhook payloads.
  • enabled: Boolean indicating whether the webhook is active.

JSON

FieldTypeDescription
urlstringThe endpoint URL for the webhook
namestringA descriptive name for the webhook
secretstringA secret key for securing payloads
enabledbooleanWhether the webhook is active

Request Example

from iqsuite import IQSuiteClient, AuthenticationError, APIError
 
client = IQSuiteClient(api_key="YOUR_API_KEY")
webhook_url = "https://yourdomain.com/webhook"
name = "My Webhook"
secret = "supersecretkey"
enabled = True
 
try:
    webhook = client.create_webhook(url=webhook_url, name=name, secret=secret, enabled=enabled)
    print(f"Webhook ID: {webhook.id}")
except AuthenticationError:
    print("Invalid API key")
except APIError as e:
    print(f"API Error: {e}")

Response

Success

Status Code: 201 Created

Body:

{
  "webhook": {
    "id": "webhook_12345",
    "url": "https://yourdomain.com/webhook",
    "name": "My Webhook",
    "secret": "supersecretkey",
    "enabled": true,
    "created_at": "2023-01-04T00:00:00Z"
  }
}

On this page