Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.promptlayer.com/llms.txt

Use this file to discover all available pages before exploring further.

PromptLayer webhooks let your systems react to workspace changes so you can keep prompt caches fresh, trigger CI/CD or GitOps workflows, sync external systems, and monitor asynchronous jobs without polling. For event names and payload details, see Events.

Configuring a Webhook

To set up a webhook, go to the Webhook section in the Settings page. Enter the URL of the endpoint you want to send the webhook to and click Submit. Creating Webhook

Securing Your Webhook

When you create a webhook, you’ll receive a webhook secret signature that looks like this: Webhook Secret Signature This secret is used to verify that incoming webhook requests are authentic and come from PromptLayer. The signature is included in the X-PromptLayer-Signature header of each webhook request.

Verifying Webhook Signatures

Here are code examples showing how to verify the signatures:

import hmac
import hashlib
import json

signature = "HEADER FROM X-PromptLayer-Signature" # Replace with actual header value
secret_key = "SECRET KEY FROM PROMPTLAYER DASHBOARD" # Replace with actual secret key
payload = {} # Replace with actual payload
payload_str = json.dumps(payload, sort_keys=True)
expected_signature = hmac.new(
    key=secret_key.encode(),
    msg=payload_str.encode('utf-8'),
    digestmod=hashlib.sha256
).hexdigest()

if hmac.compare_digest(expected_signature, signature):
    print("Signature is valid")
else:
    print("Signature is invalid")