Create and revoke API keys used to authenticate requests to the Nuntly API.
Summary
Functions
Create Api Key
Generate a new API key. The key value is only returned once. Store it securely.
Arguments
client— ANuntly.Clientreturned byNuntly.new/1.body— application/json request body usingCreateApiKeyRequest. 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
Revoke an API key. Requests authenticating with this key will be rejected immediately.
Arguments
client— ANuntly.Clientreturned byNuntly.new/1.id— Required path parameter, string. The id of the api keyopts— 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
Returns all API keys for the organization. Key values are never included in list responses.
Arguments
client— ANuntly.Clientreturned byNuntly.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 to30.
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
Returns API key metadata. The key value is never returned after creation.
Arguments
client— ANuntly.Clientreturned byNuntly.new/1.id— Required path parameter, string. The id of the api keyopts— 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
Update the key name, permissions, or restrict it to specific sending domains.
Arguments
client— ANuntly.Clientreturned byNuntly.new/1.id— Required path parameter, string. The id of the api keybody— application/json request body usingUpdateApiKeyRequest. 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"
}
)