API Keys

Do not construct this object directly, instead access the api_keys property of an ngrok.Client object.

class ngrok.services.APIKeysClient(client)[source]

API Keys are used to authenticate to the ngrok API <https://ngrok.com/docs/api#authentication>`_. You may use the API itself to provision and manage API Keys but you’ll need to provision your first API key from the API Keys page <https://dashboard.ngrok.com/api/keys>`_ on your ngrok.com dashboard.

create(description='', metadata='')[source]

Create a new API key. The generated API key can be used to authenticate to the ngrok API.

Parameters
  • description (str) – human-readable description of what uses the API key to authenticate. optional, max 255 bytes.

  • metadata (str) – arbitrary user-defined data of this API key. optional, max 4096 bytes

https://ngrok.com/docs/api#api-api-keys-create

Return type

APIKey

delete(id)[source]

Delete an API key by ID

Parameters

id (str) – a resource identifier

https://ngrok.com/docs/api#api-api-keys-delete

get(id)[source]

Get the details of an API key by ID.

Parameters

id (str) – a resource identifier

https://ngrok.com/docs/api#api-api-keys-get

Return type

APIKey

list(before_id=None, limit=None)[source]

List all API keys owned by this account

Parameters
  • before_id (Optional[str]) –

  • limit (Optional[str]) –

https://ngrok.com/docs/api#api-api-keys-list

Return type

APIKeyList

update(id, description=None, metadata=None)[source]

Update attributes of an API key by ID.

Parameters
  • id (str) –

  • description (Optional[str]) – human-readable description of what uses the API key to authenticate. optional, max 255 bytes.

  • metadata (Optional[str]) – arbitrary user-defined data of this API key. optional, max 4096 bytes

https://ngrok.com/docs/api#api-api-keys-update

Return type

APIKey