Skip to content
ClickHouse Docs
ClickHouse DocsClickHouse Docs

Create key

POST/v1/organizations/{organizationId}/keys

Creates new API key.

Authorizations

Path parameters

  • organizationIdstringrequired

    ID of the organization that will own the key.

    format: uuid

Request bodyJSON

  • nameoptionalstring

    Name of the key.

  • expireAtoptionalstring | null

    Timestamp the key expires. If not present, null or is empty the key never expires. ISO-8601.

    format: date-time
  • stateoptionalenabledordisabled

    Initial state of the key: 'enabled', 'disabled'. If not provided the new key will be 'enabled'.

  • hashDataoptionalobject
    3 properties
    • keyIdHashoptionalstring

      Hash of the key ID.

    • keyIdSuffixoptionalstring

      Last 4 digits of the key ID. Algorithm: echo -n "yourpassword" | sha256sum | tr -d '-' | xxd -r -p | base64

    • keySecretHashoptionalstring

      Hash of the key secret. Algorithm: echo -n "yourpassword" | sha256sum | tr -d '-' | xxd -r -p | base64

  • rolesdeprecatedarray ofadminordeveloperorquery_endpoints

    DEPRECATED. Use assignedRoleIds instead. List of roles assigned to the key. Contains at least 1 element.

  • assignedRoleIdsoptionalarray ofstring

    Array of role UUIDs to assign to the API key

    format: uuid
  • ipAccessListoptionalarray ofobject

    List of IP addresses allowed to access the API using this key

    2 properties
    • sourceoptionalstring

      IP or CIDR

    • descriptionoptionalstring

      Optional description of IPv4 address or IPv4 CIDR to allow access from

Response

JSON

200

Successful response

JSON
  • statusoptionalnumber

    HTTP status code.

    Example: 200
  • requestIdoptionalstring

    Unique id assigned to every request. UUIDv4

    format: uuid
  • resultoptionalobject
    3 properties
    • keyoptionalobject
      10 properties
      • idoptionalstring

        Unique API key ID.

        format: uuid
      • nameoptionalstring

        Name of the key

      • stateoptionalenabledordisabled

        State of the key: 'enabled', 'disabled'.

      • rolesdeprecatedarray ofadminordeveloperorquery_endpoints

        DEPRECATED. Use assignedRoles instead. List of roles assigned to the key. For organizations that have migrated to custom roles, this field is frozen at the pre-migration value and does not reflect current role assignments.

      • assignedRolesoptionalarray ofobject

        Custom roles and System roles assigned to this API key

        3 properties
        • roleIdoptionalstring

          Unique identifier of the role

          format: uuid
        • roleNameoptionalstring

          Human-readable name of the role

        • roleTypeoptionalsystemorcustom

          Type of role: system (predefined) or custom (organization-defined)

      • keySuffixoptionalstring

        Last 4 letters of the key.

      • createdAtoptionalstring

        Timestamp the key was created. ISO-8601.

        format: date-time
      • expireAtoptionalstring | null

        Timestamp the key expires. If not present, null or is empty the key never expires. ISO-8601.

        format: date-time
      • usedAtoptionalstring

        Timestamp the key was used last time, with one-minute precision. If not present the key was never used. ISO-8601.

        format: date-time
      • ipAccessListoptionalarray ofobject

        List of IP addresses allowed to access the API using this key

        2 properties
        • sourceoptionalstring

          IP or CIDR

        • descriptionoptionalstring

          Optional description of IPv4 address or IPv4 CIDR to allow access from

    • keyIdoptionalstring

      Generated key ID. Provided only if there was no 'hashData' in the request.

    • keySecretoptionalstring

      Generated key secret. Provided only if there was no 'hashData' in the request.

Navigation