Skip to main content
Version: 2019-05-29 (Current)

Create Webhook Secret

Create a new webhook signing secret for your account. The secret value is only returned once at creation time - store it securely immediately. Use this secret to verify that incoming webhook events are genuinely from Omise.


Request Parametersโ€‹

This endpoint does not require any request parameters. A new signing secret will be generated automatically.

Optional - 1 fieldOptional Parameters

Responsesโ€‹

200

Webhook secret created successfully

Webhook secret created. The secret value is included in this response only - it will not be retrievable again. Store it securely immediately.

Response includes:
  • object - Object type (always "webhook_secret")
  • id - Unique secret identifier (whsec_*). Store this for management.
  • secret - The actual signing secret. Store this immediately - it will not be shown again.
  • livemode - Whether this is a live mode secret
  • created_at - ISO 8601 timestamp of creation
  • metadata - Custom key-value data (if provided)

400

Bad request

Request validation failed. Check the error message for details.

Common causes:
  • Metadata exceeds 15,000 characters
  • Invalid metadata format
  • Maximum number of secrets reached

401

Unauthorized

Authentication failed. Invalid or missing API key.

Common causes:
  • Missing Authorization header
  • Invalid secret key
  • Using public key instead of secret key
  • Incorrect HTTP Basic Auth format

5xx

Server error

Server-side error occurred. These are rare but should be handled gracefully.

How to handle:

Code samplesโ€‹

curl https://api.omise.co/webhooks/secrets \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-X POST

Error and result codesโ€‹

Common Error Codesโ€‹

CodeDescriptionResolution
authentication_failureInvalid API keyVerify your secret key is correct
bad_requestInvalid parametersCheck metadata format and size
limit_reachedMaximum secrets reachedDelete unused secrets before creating new ones

Webhook Secret Fieldsโ€‹

FieldDescription
objectObject type (always "webhook_secret")
idUnique secret identifier (whsec_*)
secretThe signing secret (only shown at creation)
livemodeWhether this is a live mode secret
created_atISO 8601 timestamp of creation
metadataCustom key-value data

Important Notesโ€‹

Store the Secret Immediatelyโ€‹

The secret field is only returned once when the webhook secret is created. After this response, you will only be able to see the secret's ID, creation date, and metadata - not the actual secret value.

Store the secret in a secure location such as:

  • Environment variables
  • AWS Secrets Manager
  • HashiCorp Vault
  • Google Cloud Secret Manager
  • Azure Key Vault

Using Multiple Secretsโ€‹

You can have multiple active webhook secrets at once. This is useful during key rotation:

  1. Create a new secret
  2. Update your verification code to accept both old and new secrets
  3. Deploy the updated verification code
  4. Delete the old secret

๐Ÿ”‘API Credentials

Try it outโ€‹

Additional - 1 fields
Your IP: ...Loading...