Add Public key to product

Description

Add a public key to a product to allow the signaling server to authenticate incoming requests. The added key will use the fingerprint of the public key in the key ID in the format products:<FINGERPRINT>. This ID must be referenced when invoking the signaling server.

Request

POST /v1/webrtc/products/:product/publickeys
{
   publicKey: string 
}

Response

Successful response contains the following JSON formated body:

{
   productId: string,
  organizationId: string,
  region: string,
  name: string|null,
  created: string,
  tags: {
    [key: string]: string
  },
  expired: boolean,
  expiresAt: string|null,
  configuredDevices: number,
  publicKeys: {
    id: string,
    key: string
  }[] 
}

Response Status codes:

  • 200 on success

Request headers

This request must have the following headers:

  • Authorization: bearer <ApiKey>
  • X-Nabto-Organization: <organizationId>
  • Content-Type: application/json

Example

Request

curl -XPOST "https://api.cloud.nabto.com/v1/webrtc/products/:product/publickeys" \
  -H "Authorization: Bearer <ApiKey>" \
  -H "X-Nabto-Organization: <OrganizationId>" \
  -H "Content-Type: application/json" \
  -d '{ "publicKey": "<publicKey>"}'

Response

{
   "productId": "pr-abcdefgh",
  "organizationId": "or-lmnopqrs",
  "region": "<region>",
  "name": "friendly name",
  "created": "2022-10-18T10:17:24.299Z",
  "tags": {
    "foo": "bar" 
  },
  "expired": true,
  "expiresAt": "2022-10-18T10:17:24.299Z",
  "configuredDevices": 42,
  "publicKeys": [{
     "id": "<id>",
    "key": "<key>" 
  }
   ,
  ...],
  
}