Skip to main content
npayload is launching soon.
npayloadDocs
API ReferenceChannels

Create a channel

Create a new event channel.

POST/v1/channels

Authorization

ApiKeyAuth
AuthorizationBearer <token>

API key authentication. Keys are prefixed with environment:

  • npk_live_ for production
  • npk_test_ for testing/staging

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://api.npayload.com/v1/channels" \  -H "Content-Type: application/json" \  -d '{    "name": "orders.created",    "description": "Events for new order creation",    "schema": {      "type": "object",      "properties": {        "orderId": {          "type": "string"        },        "amount": {          "type": "number"        }      },      "required": [        "orderId",        "amount"      ]    }  }'
{
  "id": "string",
  "name": "string",
  "description": "string",
  "status": "active",
  "schema": {},
  "retentionDays": 0,
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z"
}
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "Validation failed",
    "details": {
      "field": "name",
      "reason": "Name is required"
    }
  }
}
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or missing API key"
  }
}
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "string",
    "details": {}
  }
}

Was this page helpful?