Create a new keyset

POST 

/v2/keysets

Creates a new keyset in a specified app either with default configuration or with optional configuration provided with request. Settings left out of the request are stored with their default values, so the config in the response is exactly what is stored and what a following config read returns. For more configuration examples, see the config section of the API.

Note:

  • Creating a keyset requires both keyset:write and keyset-secret:read permissions on the app. The secretKeys field will always be included in the creation response.
  • Free and paid accounts can create production keysets, subject to the total account keyset quota and applicable feature restrictions. Testing and production keysets share that quota. Testing keysets have lower rate limits; production mode does not grant paid-plan entitlements.
  • Secret keys are only available at creation time and will not be returned in subsequent GET requests.
  • Every call creates a new keyset; repeating a request does not return the keyset created before.
  • files.region, appContext.region, and dataSync.region cannot be changed after initial setup.
  • Enabling DataSync requires a configured DataSync region. Customer DataSync requests require Access Manager, which must be enabled separately using accessManager.enabled; enabling DataSync does not enable it automatically.
  • The region of files, appContext and dataSync can be omitted or sent as null. A feature cannot be created enabled without a region.
  • Push notification credentials are not part of the keyset configuration. Upload them with the FCM and APNs upload operations after the keyset is created.

Request​

Example
{
  "keyset": {
    "name": "string",
    "type": "testing",
    "appId": "string",
    "id": "string",
    "publishKey": "string",
    "subscribeKey": "string",
    "createdAt": "string",
    "updatedAt": "string",
    "secretKeys": [
      {
        "secretKey": "string",
        "expiresAt": "string"
      }
    ]
  },
  "config": {
    "accessManager": {
      "enabled": false,
      "tokenRevoke": false
    },
    "files": {
      "enabled": false,
      "region": "string",
      "retention": 0
    },
    "streamController": {
      "enabled": false,
      "wildcardSubscribe": false,
      "channelGroupLimit": 0
    },
    "appContext": {
      "enabled": false,
      "userMetadataEvents": false,
      "channelMetadataEvents": false,
      "membershipEvents": false,
      "disallowGetAllChannelMetadata": false,
      "disallowGetAllUserMetadata": false,
      "referentialIntegrity": false,
      "region": "string"
    },
    "dataSync": {
      "enabled": false,
      "region": "string"
    },
    "messagePersistence": {
      "enabled": false,
      "includePresenceEvents": false,
      "deleteFromHistory": false,
      "retention": 0
    },
    "presence": {
      "enabled": false,
      "deltas": false,
      "generateLeaveOnDisconnect": false,
      "streamFiltering": false,
      "activeNoticeChannel": "string",
      "announceMax": 0,
      "interval": 0,
      "debounce": 0,
      "enableLegacySDKTracking": false,
      "rules": [
        {}
      ]
    }
  }
}
Example
{
  "statusCode": 0,
  "error": "BadRequest",
  "message": [
    "string"
  ]
}
Example
{
  "statusCode": 0,
  "error": "Unauthorized",
  "message": [
    "string"
  ]
}
Example
{
  "statusCode": 0,
  "error": "Forbidden",
  "message": [
    "string"
  ]
}
Example
{
  "statusCode": 0,
  "error": "NotFound",
  "message": [
    "string"
  ]
}
Example
{
  "statusCode": 0,
  "error": "InternalError",
  "message": [
    "string"
  ]
}
Example
{
  "statusCode": 0,
  "error": "ServiceUnavailable",
  "message": [
    "string"
  ]
}