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. 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 on your ngrok.com dashboard.

create(description='', metadata='', owner_id=None)[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

  • owner_id (Optional[str, None]) – If supplied at credential creation, ownership will be assigned to the specified User or Bot. Only admins may specify an owner other than themselves. Defaults to the authenticated User or Bot.

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, None]) –

  • limit (Optional[str, None]) –

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, None]) – human-readable description of what uses the API key to authenticate. optional, max 255 bytes.

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

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

Return type:

APIKey