Hubble Network API Keys API

The API Keys API from Hubble Network — 4 operation(s) for api keys.

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

hubble-network-api-keys-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Hubble Platform API Keys API
  description: "The Hubble platform is built API-first. Use our Cloud API to manage your devices\nand access device data programmatically. \nWe've designed our API following RESTful principles. \nEach endpoint returns standard HTTP status codes and may include JSON payloads.\n\n---\n\n## API Access\nUse API Keys to authenticate with the Hubble Cloud API for your organization. \n\n### Generate an API Key\nLog in to your Hubble dashboard. Navigate to **Developer Tools > API Tokens** to create a new API Key. \nProvide a name for the token, and set an appropriate expiration date for temporary access.\n\n### Organization ID\nYou will need `org_id` to make API requests. From your Hubble dashboard, navigate to \n**Developer Tooks > API Tokens**, or **Organization Settings**, to find your Organization ID. \n\n### Authorization Scopes\nAPI endpoints require specific authorization scopes to perform the intended operation. \n**Required Scope** is always provided in the API documentation.\n\nAPI Keys can be created with specific authorization scopes that control what operations the key can perform. \nIf no scopes are specified, the key will be created with all available scopes (admin-level access).\n\n| **Scope**                   | **Access**                                     |\n|------------------------------|-------------------------------------------------|\n| **read-api-keys**            | View API keys and their metadata               |\n| **write-api-keys**           | Create, update, and delete API keys            |\n| **read-users**               | View user information and roles                |\n| **write-users**              | Add, update, and remove users from the organization |\n| **read-organization-metadata** | View organization details and settings       |\n| **write-organization-metadata** | Update organization information            |\n| **read-devices**             | View device information and status             |\n| **write-devices**            | Register and manage devices                    |\n| **read-invitations**         | View pending invitations                       |\n| **write-invitations**        | Create and revoke user invitations             |\n| **read-packets**             | Access packet data and retrieval endpoints     |\n| **read-platform-metrics**    | View platform metrics and analytics            |\n| **read-billing-usage**       | View billing usage information                 |\n| **read-billing-invoices**    | View billing invoices                          |\n| **read-webhooks**            | View webhook configurations                    |\n| **write-webhooks**           | Create and manage webhook endpoints            |\n    \n**Example Scope Combinations**\n- Create a key with read-only access: `[\"read-api-keys\", \"read-users\", \"read-devices\"]`\n- Create a key for device management: `[\"read-devices\", \"write-devices\"]`\n- Create a key for user management: `[\"read-users\", \"write-users\", \"read-invitations\", \"write-invitations\"]`\n    \n**Best Practices for Data Security**\n- Create keys with the minimum required scopes for your use case\n- Regularly review and rotate API keys\n- Use descriptive names for your keys to track their purpose\n- Set appropriate expiration dates for temporary access    \n\n---\n\n## Import API Definition\nYou can quickly import the Hubble Cloud API into your preferred developer environment (such as Postman or Insomnia) using our **public OpenAPI definition**.\nSimply download or import the YAML file directly:\n\n[https://hubble.com/docs/openapi.yaml](https://hubble.com/docs/openapi.yaml)\n\n---\n\n## Pagination\nWhen the number of objects requested exceeds the maximum page size for an endpoint, the API response will be paginated. \nThis means you will receive a subset of the total results, along with a `Continuation-Token` in the Response Header that can be used to fetch subsequent subsets.\n\nTo retrieve the next set of data, you must use the provided `Continuation-Token` in the Request Header of your next API call to the same endpoint. \nContinue using the provided token in each successive request until no `Continuation-Token` is returned, which indicates you have retrieved all available data.\n\n---\n\n## Rate Limits\nThe Hubble Cloud API follows a leaky bucket approach to rate limiting. Endpoints are rate limited to three (3) requests per second. \nYour organization is limited to a total of 15 requests per second. \nIf you exceed this limit, you will receive a 429 status code. \nWe recommend backoff retry logic to stay within the limit.\n\n---\n\n## Request Headers\nAll HTTP responses will include a `X-Request-ID` header that is logged internally and can be used for tracing/debugging a particular API request. \nAll HTTP requests can include a `X-Request-ID` header which will be logged and mapped to the responses' `X-Request-ID` header. \n\nShare Request Headers whenever troubleshooting an API issue with Hubble Support.\n\n---\n\n## Status Codes\nThe Hubble Cloud API returns the following HTTP status codes: `200`, `400`, `401`, `403`, `404`, `429` and `500`. \nUse the tailored message returned with each status code for insight in the specific context of the endpoint you are attempting to access.\n\n---\n\n## Versioning\nOur cloud backend follows a rolling release model. This means:\n- **Continuous Deployment**: New features, security updates, and performance improvements are automatically rolled out.\n- **Backward Compatibility**: Cloud updates are designed to be compatible with devices running firmware/SDK versions within our active or maintained support windows.\n- **Transparent Change Management**: Release notes and changelogs are published regularly so you can track enhancements and understand any adjustments that might affect integrations.\n- **Versioned Public API**: The Cloud API uses basic major versioning in the url paths (`/v1/...`, `/v2/...` etc.). Major backwards incompatible changes will be made by creating a version of the endpoint with a higher version and communicating with customers to migrate. The legacy `/api/...` and `/api/v2/...` paths remain fully supported as aliases for `/v1/...` and `/v2/...` respectively, so previous versions will be supported for a minimum of 1 year.\n\n---\n"
  version: 1.0.0
servers:
- url: https://api.hubble.com
  description: Production
security:
- BearerAuth: []
tags:
- name: API Keys
paths:
  /v1/org/{org_id}/check:
    get:
      tags:
      - API Keys
      operationId: validate-api-key
      x-criticality: high
      summary: Validate an API Key
      description: Confirm your API key is valid.
      parameters:
      - $ref: '#/components/parameters/orgIdPathParam'
      responses:
        '200':
          description: API key validated
          content:
            application/json:
              schema:
                type: object
                properties:
                  org_id:
                    $ref: '#/components/schemas/orgId'
        '400':
          $ref: '#/components/responses/ErrorBadRequest'
        '500':
          $ref: '#/components/responses/ErrorInternalServer'
  /v1/org/{org_id}/key:
    post:
      tags:
      - API Keys
      operationId: provision-api-key
      x-criticality: high
      summary: Provision an API Key
      description: "Provision a new API Key for your organization.\n\n**Required Scope:** `write-api-keys`\n\n### Authorization Scopes\nAPI Keys can be created with specific authorization scopes that control what operations the key can perform. \nIf no scopes are specified, the key will be created with all available scopes (admin-level access).\nSee the Cloud API \"Introduction\" for a complete list authorization scopes.\n\n### Expiration Date\nSet an appropriate expiration date for temporary API access. For no expiration, set to `0`.\n"
      parameters:
      - $ref: '#/components/parameters/orgIdPathParam'
      - $ref: '#/components/parameters/contentTypeJsonHeader'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  $ref: '#/components/schemas/apiKeyName'
                expires_at_seconds:
                  $ref: '#/components/schemas/apiKeyExpiration'
                scopes:
                  $ref: '#/components/schemas/authScope'
                  example:
                  - read-api-keys
                  - read-users
                  - read-devices
      responses:
        '200':
          description: API key provisioned
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/apiKeyItem'
                - type: object
                  properties:
                    key:
                      $ref: '#/components/schemas/apiKey'
        '400':
          $ref: '#/components/responses/ErrorBadRequest'
        '500':
          $ref: '#/components/responses/ErrorInternalServer'
    get:
      tags:
      - API Keys
      operationId: list-api-keys
      x-criticality: high
      summary: List all API Keys
      description: 'List all valid API Keys for your organization.


        **Required Scope:** `read-api-keys`

        '
      parameters:
      - $ref: '#/components/parameters/orgIdPathParam'
      responses:
        '200':
          description: List of API keys
          content:
            application/json:
              schema:
                type: object
                properties:
                  keys:
                    type: array
                    items:
                      $ref: '#/components/schemas/apiKeyItem'
        '400':
          $ref: '#/components/responses/ErrorBadRequest'
        '500':
          $ref: '#/components/responses/ErrorInternalServer'
  /v1/org/{org_id}/key/{key_id}:
    delete:
      tags:
      - API Keys
      operationId: delete-api-key
      x-criticality: high
      summary: Delete an API Key
      description: 'Permanently delete an API Key from your organization.


        **Required Scope:** `write-api-keys`

        '
      parameters:
      - $ref: '#/components/parameters/orgIdPathParam'
      - name: key_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/apiKeyId'
        description: API key ID
      responses:
        '200':
          description: API key deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  key_id:
                    $ref: '#/components/schemas/apiKeyId'
        '400':
          $ref: '#/components/responses/ErrorBadRequest'
        '500':
          $ref: '#/components/responses/ErrorInternalServer'
    patch:
      tags:
      - API Keys
      operationId: update-api-key
      x-criticality: high
      summary: Update an API Key
      description: 'Update metadata for an API key, including name, authorization scopes, and expiration time.


        **Required Scope:** `write-api-keys`


        ### Authorization Scopes

        You may update the scopes assigned to an API key to change its permissions. See the Cloud API "Introduction" for a complete list authorization scopes.


        ### Expiration Time

        You may update the expiration time for an API key. Set to 0 to remove expiration (key will never expire).

        '
      parameters:
      - $ref: '#/components/parameters/orgIdPathParam'
      - name: key_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/apiKeyId'
        description: API key ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                set_name:
                  $ref: '#/components/schemas/apiKeyName'
                set_scopes:
                  $ref: '#/components/schemas/authScope'
                  example:
                  - read-api-keys
                  - read-users
                  - read-devices
                set_expires_at_seconds:
                  $ref: '#/components/schemas/apiKeyExpiration'
      responses:
        '200':
          description: API Key Updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiKeyItem'
        '400':
          $ref: '#/components/responses/ErrorBadRequest'
        '500':
          $ref: '#/components/responses/ErrorInternalServer'
  /v1/org/{org_id}/key_scopes:
    get:
      tags:
      - API Keys
      operationId: list-key-scopes
      x-criticality: high
      summary: List Key Scopes
      description: 'Retrieve a list of all available authorization scopes that can be assigned to API keys.

        This endpoint returns scope IDs and human-readable display names.


        **Required Scope:** `read-api-keys`

        '
      parameters:
      - $ref: '#/components/parameters/orgIdPathParam'
      responses:
        '200':
          description: List of available scopes
          content:
            application/json:
              schema:
                type: object
                properties:
                  scopes:
                    type: array
                    items:
                      type: object
                      properties:
                        scope_id:
                          $ref: '#/components/schemas/authScope'
                          description: The scope identifier used in API requests
                        display_name:
                          type: string
                          description: Human-readable name for the scope
                      required:
                      - scope_id
                      - display_name
                    description: List of all available authorization scopes
        '400':
          $ref: '#/components/responses/ErrorBadRequest'
        '500':
          $ref: '#/components/responses/ErrorInternalServer'
components:
  schemas:
    utcTimestampInteger:
      type: integer
      format: int64
      description: An UTC second-precision timestamp formatted as an integer
    authScope:
      type: string
      enum:
      - read-api-keys
      - write-api-keys
      - read-users
      - write-users
      - read-organization-metadata
      - write-organization-metadata
      - read-devices
      - write-devices
      - read-invitations
      - write-invitations
      - read-packets
      - read-platform-metrics
      - read-billing-usage
      - read-billing-invoices
      - read-webhooks
      - write-webhooks
      description: Authorization scope for API key permissions
    apiKeyName:
      type: string
      description: A name for an API Key
      maxLength: 250
    errorResponse:
      type: object
      properties:
        code:
          type: integer
          description: The HTTP status code
        description:
          type: string
          description: 'A description for the error.

            For user errors, we attempt to be as descriptive as possible to help with diagnosing the issue.

            For internal errors, the error description is only indicates that a retry should occur but we log the full error so that we can diagnose it.

            Error descriptions can change over time and should not be programmed against.

            '
        name:
          type: string
          enum:
          - Bad Request
          - Unauthorized
          - Not Found
          - Too Many Requests
          - Internal Server Error
          description: '`name` is a short name for the error.

            '
    apiKeyId:
      type: string
      description: An ID for an API key
    orgId:
      type: string
      format: uuid
      description: The ID for an organization
    apiKeyItem:
      type: object
      description: An API Token used to authenticate with the Hubble Platform
      properties:
        key_id:
          $ref: '#/components/schemas/apiKeyId'
        key_name:
          $ref: '#/components/schemas/apiKeyId'
        created_at:
          $ref: '#/components/schemas/utcTimestampInteger'
        expires_at_seconds:
          $ref: '#/components/schemas/apiKeyExpiration'
        scopes:
          type: array
          items:
            $ref: '#/components/schemas/authScope'
          description: List of authorization scopes assigned to this API key
    apiKey:
      type: string
      description: An API key
    apiKeyExpiration:
      type: integer
      format: int64
      description: 'An UTC second-precision timestamp formatted as an integer.

        Can be set to 0 to indicate that there is no expiration.

        '
  parameters:
    orgIdPathParam:
      name: org_id
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/orgId'
      description: Your organization ID
    contentTypeJsonHeader:
      name: Content-Type
      in: header
      schema:
        type: string
      description: An indication that the payload is JSON
      example: application/json
  responses:
    ErrorBadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/errorResponse'
          example:
            code: 400
            description: The request could not be understood by the server due to malformed syntax.
            name: Bad Request
    ErrorInternalServer:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/errorResponse'
          example:
            code: 500
            description: An unknown error has occurred.
            name: Unknown
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT