Nuntly.ApiKeys (nuntly v0.1.0)

Copy Markdown View Source

Create and revoke API keys used to authenticate requests to the Nuntly API.

Summary

Functions

create_api_key(client, body, opts \\ [])

Create Api Key

Generate a new API key. The key value is only returned once. Store it securely.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • body — application/json request body using CreateApiKeyRequest. Accepted fields:
    • "name" (string, optional) — The name of the api key
    • "status" (string, optional) — The status for the api key
    • "permission" (string, required) — The permission type for the api key
    • "domainIds" (list of string, optional) — The domain ids to restrict the api key to (only for sendingAccess)
  • opts — Optional keyword list passed to Req for this request.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.ApiKeys.create_api_key(
  client,
  %{
    "permission" => "fullAccess"
  }
)

delete_api_key(client, id, opts \\ [])

Delete Api Key

Revoke an API key. Requests authenticating with this key will be rejected immediately.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • id — Required path parameter, string. The id of the api key
  • opts — Optional keyword list passed to Req for this request.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.ApiKeys.delete_api_key(client, "id")

list_api_keys(client, params \\ %{}, opts \\ [])

List Api Keys

Returns all API keys for the organization. Key values are never included in list responses.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • params — Optional map of query parameters:
    • "cursor" — Optional query parameter, string. Pagination cursor from a previous response
    • "limit" — Optional query parameter, integer. Maximum number of items to return Defaults to 30.
  • opts — Optional keyword list passed to Req for this request.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.ApiKeys.list_api_keys(
  client,
  %{
    "cursor" => "cursor",
    "limit" => 30
  }
)

retrieve_api_key(client, id, opts \\ [])

Retrieve Api Key

Returns API key metadata. The key value is never returned after creation.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • id — Required path parameter, string. The id of the api key
  • opts — Optional keyword list passed to Req for this request.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.ApiKeys.retrieve_api_key(client, "id")

update_api_key(client, id, body, opts \\ [])

Update Api Key

Update the key name, permissions, or restrict it to specific sending domains.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • id — Required path parameter, string. The id of the api key
  • body — application/json request body using UpdateApiKeyRequest. Accepted fields:
    • "name" (string, optional) — The name of the api key
    • "status" (string, optional)
    • "permission" (string, optional) — The permission type for the api key
    • "domainIds" (list of string, optional) — The domain ids to restrict the api key to (only for sendingAccess)
  • opts — Optional keyword list passed to Req for this request.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.ApiKeys.update_api_key(
  client,
  "id",
  %{
    "name" => "Production"
  }
)