List API keys
/api/v1/api-keysThe keys your organization holds, with their prefixes, scopes and last use.
Listing is available to a key; creating and revoking are not. A leaked key that could mint its own replacement would outlive the revocation of the key that leaked, so those stay in the dashboard on purpose.
Request
/api/v1/api-keyscurl -X GET 'https://app.mailyte.com/api/v1/api-keys' \
-H 'Authorization: Bearer mk_live_YOUR_API_KEY'const response = await fetch('https://app.mailyte.com/api/v1/api-keys', {
method: 'GET',
headers: {
Authorization: 'Bearer mk_live_YOUR_API_KEY',
},
});
const { data } = await response.json();import requests
response = requests.get(
"https://app.mailyte.com/api/v1/api-keys",
headers={"Authorization": "Bearer mk_live_YOUR_API_KEY"},
)
data = response.json()["data"]<?php
$response = Http::withToken('mk_live_YOUR_API_KEY')
->get('https://app.mailyte.com/api/v1/api-keys');
$data = $response->json('data');require "net/http"
require "json"
uri = URI("https://app.mailyte.com/api/v1/api-keys")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer mk_live_YOUR_API_KEY"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request) }Response
Success.
dataarray<object>objectstringapi_keyidstringUnique identifier for the key.
namestringYour name for the key.
prefixstringThe start of the key, safe to log and show:
mk_live_(ormk_test_for a test key) and 8 more characters. Use it to tell your keys apart. A key startingmk_dead_is an old key we revoked; seerevoked_reason.scopesarray<any>What this key may do, as
resource:actionstrings. An empty list allows nothing. Scopes cannot be changed later; make a new key instead.modestringlive | testtest(prefixmk_test_) for a test key: messages are built exactly as live ones would be, then stored in your Sandbox instead of being delivered. They are not in your live event log and use no credits. Use one in CI. The mode cannot be changed after the key is made.statestringactive | expired | revokedWhether the key works. Only
activedoes. A key past its expiry readsexpired.revoked_reasonstringWhy we revoked the key, when we did. Null when the key is not revoked, or you revoked it yourself.
ip_allowlistobjectEnforced at authentication time.
enabled: falsewith a populated list is a configured allowlist that is currently off, not a contradiction.enabledbooleanaddressesarray<string>IPv4/IPv6 addresses or CIDR ranges.
last_usedobjectWhen and where the key was last used. This is updated at most once a minute, so it can be up to a minute behind.
atstringWhen the key was last used, in ISO 8601 UTC. Null means it has never been used.
ipstringThe IP address the key was last used from. Use it to spot a leaked key used from somewhere you do not know. Null when the key was never used, or the address could not be read.
expires_atstringWhen the key stops working, in ISO 8601 UTC. Null means it never expires. Read
stateto see whether the key works now.created_atstringISO 8601 UTC.
Returned inside the standard envelope.
Errors
| Status | When |
|---|---|
401 | The API key is missing, unknown, revoked or expired. All four answer identically, on purpose: distinguishing them would confirm which keys exist. |
403 | The key is valid but may not do this: it lacks the required scope, its IP allowlist does not include you, or this endpoint does not accept API keys. |
404 | No such resource in this organization. |
422 | The request was understood but the values were not acceptable. |
429 | Too many requests, or the organization has spent its sending allowance. `Retry-After` says how long to wait. |
Every status, with what causes it and what to do, is on the error reference.