> For the complete documentation index, see [llms.txt](https://docs.channex.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.channex.io/api-v.1-documentation/webhook-collection/create-signing-key-api.md). Agents can also search and read this documentation through its [MCP server](https://docs.channex.io/~gitbook/mcp).

# Create Signing Key API

## Create a signing key

> Create a signing key owned by the billing account named in \`billing\_account\_id\`. The\
> key is created together with its first, current secret version, and the response is\
> the only unmasked rendering of that version's \`secret\`.

```json
{"openapi":"3.1.0","info":{"title":"Channex.io — Public API","version":"0.0.0"},"tags":[{"name":"Webhook Signing Keys","description":"HMAC keys that sign webhook deliveries, so that a receiving endpoint can tell that a\ncallback came from Channex and that its body was not altered on the way.\n\nA key is a shared secret: Channex holds it and so do you. It is not an API credential\n— it authenticates nothing against this API and grants no access. It is used in one\ndirection only, on the callbacks Channex sends to you.\n\nA key belongs to a billing account and holds up to two secret versions — the current\none plus an optional pending one, which is what makes rotation zero-downtime. To turn\nsigning on, point a webhook at the key with `signing_key_id` and set `is_signed`.\n\n## What is signed\n\nEvery delivery of a signed webhook — the `POST` Channex makes to the webhook's\n`callback_url` — carries three headers:\n\n- `x-hmac-timestamp` — Unix timestamp (seconds) taken when the delivery was signed.\n- `x-hmac-signature-256` — comma-separated lowercase-hex HMAC-SHA256 signatures, one\n  per secret version of the key, the current version first.\n- `x-hmac-keys-256` — comma-separated version labels (`...` followed by each secret's\n  last 6 characters), in the same order as the signatures.\n\nEach signature is computed over the string `{timestamp}.{raw request body}`: the value\nof `x-hmac-timestamp`, a dot, and the exact bytes of that delivery's body. Nothing else\nenters it — neither the callback URL nor the webhook's `request_params` and `headers`.\n\n## Verifying a delivery\n\nRecompute HMAC-SHA256 over `{timestamp}.{raw body}` with your stored secret, then\ncompare it against the signature at the position whose label in `x-hmac-keys-256` ends\nwith your secret's last 6 characters.\n\n## Rotating a key\n\n`generate` adds a pending secret version beside the current one, and deliveries are\nthen signed with both — so verification against the current secret keeps working while\nthe new secret is stored on your side. `rotate` promotes the newest version to be the\nsole current version, after which deliveries carry its signature alone."}],"servers":[{"url":"https://app.channex.io/api/v1","description":"Production server","variables":{}},{"url":"https://staging.channex.io/api/v1","description":"Staging server","variables":{}}],"security":[{"UserApiKeyAuth":[]}],"components":{"securitySchemes":{"UserApiKeyAuth":{"type":"apiKey","in":"header","name":"user-api-key","description":"API key for programmatic access, sent in the `user-api-key` header."}},"schemas":{"SigningKeys.SigningKeyWithSecretResource":{"type":"object","required":["type","id","attributes","relationships"],"properties":{"type":{"type":"string","enum":["signing_key"]},"id":{"$ref":"#/components/schemas/Common.Scalars.id"},"attributes":{"$ref":"#/components/schemas/SigningKeys.SigningKeyWithSecret"},"relationships":{"$ref":"#/components/schemas/SigningKeys.SigningKeyRelationships"}},"description":"A signing key resource carrying the secret of the version just created or promoted."},"Common.Scalars.id":{"type":"string","format":"uuid"},"SigningKeys.SigningKeyWithSecret":{"type":"object","required":["id","inserted_at","updated_at","rotated_at","title","secret"],"properties":{"id":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.id"}],"description":"Unique signing key identifier. Mirrors the top-level resource `id`."},"inserted_at":{"type":"string","format":"date-time","description":"When the key was created (ISO 8601, no timezone offset)."},"updated_at":{"type":"string","format":"date-time","description":"When the key was last updated (ISO 8601, no timezone offset)."},"rotated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"format":"date-time","description":"When the key was last rotated (ISO 8601, no timezone offset). Null until the first rotation."},"title":{"type":"string","description":"Human-readable name of the key."},"secret":{"type":"string","description":"The full secret of the version the operation created. Exposed only in this\nresponse — store it now; every other rendering masks version secrets to\n`...` plus their last 6 characters."}},"description":"A signing key as returned by create and generate — the only responses carrying an unmasked `secret`."},"SigningKeys.SigningKeyRelationships":{"type":"object","required":["signing_key_versions","webhooks"],"properties":{"signing_key_versions":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SigningKeys.SigningKeyVersionResource"}}},"required":["data"],"description":"The key's secret versions — the current one first, then oldest first. Secrets are masked to `...` plus their last 6 characters."},"webhooks":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SigningKeys.SigningKeyWebhookResource"}}},"required":["data"],"description":"The webhooks that sign their deliveries with the key, oldest first. Empty when no webhook uses it."}},"description":"Relationships of a signing key: its secret versions and the webhooks using it."},"SigningKeys.SigningKeyVersionResource":{"type":"object","required":["type","id","attributes"],"properties":{"type":{"type":"string","enum":["signing_key_version"]},"id":{"$ref":"#/components/schemas/Common.Scalars.id"},"attributes":{"$ref":"#/components/schemas/SigningKeys.SigningKeyVersion"}},"description":"A secret version of a signing key. Carries no relationships."},"SigningKeys.SigningKeyVersion":{"type":"object","required":["id","is_current","secret","inserted_at"],"properties":{"id":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.id"}],"description":"Unique version identifier. Mirrors the resource `id`."},"is_current":{"type":"boolean","description":"Whether this is the key's current version. A key has one current version and at most\none pending version awaiting rotation."},"secret":{"type":"string","description":"The version's secret masked to `...` plus its last 6 characters — the label\nidentifying the version in the `x-hmac-keys-256` delivery header and in API\nresponses. The full secret is never rendered here."},"inserted_at":{"type":"string","format":"date-time","description":"When the version was created (ISO 8601, no timezone offset)."}},"description":"A secret version of a signing key."},"SigningKeys.SigningKeyWebhookResource":{"type":"object","required":["type","id","attributes"],"properties":{"type":{"type":"string","enum":["webhook"]},"id":{"$ref":"#/components/schemas/Common.Scalars.id"},"attributes":{"$ref":"#/components/schemas/SigningKeys.SigningKeyWebhook"}},"description":"A webhook that signs its deliveries with the key."},"SigningKeys.SigningKeyWebhook":{"type":"object","required":["id","callback_url","event_mask","is_global"],"properties":{"id":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.id"}],"description":"Unique webhook identifier. Mirrors the resource `id`."},"callback_url":{"type":"string","format":"uri","description":"URL the webhook delivers to."},"event_mask":{"type":"string","description":"Events the webhook subscribes to: `*` for every event, or a semicolon-separated list of event names."},"is_global":{"type":"boolean","description":"Whether the webhook covers every property of its billing account rather than one."}},"description":"A webhook using the signing key, reduced to its identifying attributes."},"Common.Errors.UnparsableRequest":{"type":"object","required":["errors"],"properties":{"errors":{"$ref":"#/components/schemas/Common.Errors.UnparsableRequestObject"}},"description":"The request body could not be parsed as JSON."},"Common.Errors.UnparsableRequestObject":{"type":"object","required":["code","title","details"],"properties":{"code":{"type":"string","enum":["bad_request"]},"title":{"type":"string","enum":["Bad Request"]},"details":{"type":"object","unevaluatedProperties":{"type":"string"},"description":"Maps the part of the request that could not be parsed to the reason."}},"description":"Error object for an unparsable request body, naming the malformed part."},"Common.Errors.Unauthorized":{"type":"object","required":["errors"],"properties":{"errors":{"type":"object","required":["code","title"],"properties":{"code":{"type":"string","enum":["unauthorized"]},"title":{"type":"string","enum":["Unauthorized"]}},"description":"Shape of a single JSON:API error object: a stable machine code plus a human-readable title."}},"description":"Authentication credentials are missing or invalid."},"Common.Errors.Forbidden":{"type":"object","required":["errors"],"properties":{"errors":{"type":"object","required":["code","title"],"properties":{"code":{"type":"string","enum":["forbidden"]},"title":{"type":"string","enum":["Forbidden"]}},"description":"Shape of a single JSON:API error object: a stable machine code plus a human-readable title."}},"description":"The authenticated user lacks permission to perform this action."},"Common.Errors.InvalidArguments":{"type":"object","required":["errors"],"properties":{"errors":{"$ref":"#/components/schemas/Common.Errors.InvalidArgumentsObject"}},"description":"The request has missing or invalid arguments; `details` lists the messages per argument."},"Common.Errors.InvalidArgumentsObject":{"type":"object","required":["code","title","details"],"properties":{"code":{"type":"string","enum":["bad_request"]},"title":{"type":"string","enum":["Bad Request"]},"details":{"type":"object","unevaluatedProperties":{"type":"array","items":{"type":"string"}},"description":"Maps each invalid argument to the list of validation messages for that argument."}},"description":"Error object for invalid request arguments, adding per-argument messages."},"Common.Errors.ValidationError":{"type":"object","required":["errors"],"properties":{"errors":{"$ref":"#/components/schemas/Common.Errors.ValidationErrorObject"}},"description":"The request body failed validation."},"Common.Errors.ValidationErrorObject":{"type":"object","required":["code","title","details"],"properties":{"code":{"type":"string","enum":["validation_error"]},"title":{"type":"string","enum":["Validation Error"]},"details":{"type":"object","unevaluatedProperties":{"type":"array","items":{"type":"string"}},"description":"Maps each invalid field to the list of validation messages for that field."}},"description":"Error object for a failed validation, adding per-field messages."},"SigningKeys.SigningKeyCreateRequest":{"type":"object","required":["signing_key"],"properties":{"signing_key":{"$ref":"#/components/schemas/SigningKeys.SigningKeyCreate"}},"description":"Request body accepted when creating a signing key."},"SigningKeys.SigningKeyCreate":{"type":"object","required":["title","billing_account_id"],"properties":{"title":{"type":"string","description":"Human-readable name of the key."},"billing_account_id":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.id"}],"description":"UUID of the billing account that owns the key. The caller must be an owner of that account; naming another answers `403`."}},"description":"Attributes accepted when creating a signing key."}}},"paths":{"/signing_keys":{"post":{"operationId":"SigningKeys_create","summary":"Create a signing key","description":"Create a signing key owned by the billing account named in `billing_account_id`. The\nkey is created together with its first, current secret version, and the response is\nthe only unmasked rendering of that version's `secret`.","parameters":[],"responses":{"201":{"description":"201 Created response wrapping a resource body.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/SigningKeys.SigningKeyWithSecretResource"}},"description":"JSON:API document wrapping a single resource."}}}},"400":{"description":"The request body could not be parsed as JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Common.Errors.UnparsableRequest"}}}},"401":{"description":"Authentication credentials are missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Common.Errors.Unauthorized"}}}},"403":{"description":"The authenticated user lacks permission to perform this action.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Common.Errors.Forbidden"}}}},"422":{"description":"The request has missing or invalid arguments; `details` lists the messages per argument.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Common.Errors.InvalidArguments"},{"$ref":"#/components/schemas/Common.Errors.ValidationError"}]}}}}},"tags":["Webhook Signing Keys"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SigningKeys.SigningKeyCreateRequest"}}}}}}}}
```
