Skip to main content
An API key lets a server you control call Lunacal as you. Lunacal shows the full key once, when you create it, and stores only a hash after that. One key can call every route in the API reference. You cannot limit a key to read-only, or to a single route.

Who can open Developer settings

Go to Settings → Developer.

Create a key

1

Open Developer settings

In Lunacal, open Settings → Developer.
2

Name the key and choose when it expires

Click Create an API key.Name this key is a label for your list, such as “Billing sync”. It is not part of the secret. The field placeholder is “E.g. Development”.Expiration date offers 7 days, 30 days, 3 months, and 1 year. 30 days is selected when the dialog opens. Turn on Never expires if the key should stay valid until you delete it.You can rename a key later. You cannot change its expiration after you save it.
3

Copy the key before you close the dialog

Lunacal shows API key created successfully and the text “Save this API key before closing this window.” Click Copy.When you close the dialog, the full key is gone. If you did not save it, delete that row and create a new key.
The value you copy starts with lunacal_. Send the whole value, including that prefix.
A key is a password for the account. Put it in a secret store or an environment variable on your server. Do not put it in a browser app, a public repository, or a screenshot. If it leaks, delete it and create a new one.

Send the key

Add this header to every request:
Also send Content-Type: application/json. Every route uses POST.
A request with no key, a mistyped key, a deleted key, or an expired key is rejected with 401. Lunacal uses the same message for all of those cases, so you cannot tell from the response which one it was. Check the key in Developer settings, then create a new one if you are unsure. The exact messages are on Errors. After a successful call, Last used on that row updates to a relative time such as “a few seconds ago”. A failed call does not update it.

Read the key list

Each key is one row.
  • The title is the name you entered. A blank name shows as Nameless API key.
  • Under the name, a masked preview starts with lunacal_ and then hides the rest. That preview is not the secret, and it is not the last characters of the secret. You cannot rebuild the key from it.
  • Created, Last used, and Expires sit on the same row. Last used says Never until the first successful call. Expires is a date, or Never expires.
  • A key past its date is marked Expired. A key that expires within 14 days is marked as expiring soon.
Above the list, three counts show how many keys are active, how many are expired, and how many never expire. Search matches the name and the preview. The filter next to search is All, active, or Expired.

Rename or delete a key

Edit opens Edit API key. Change the name and save. The expiration stays as it was. Delete opens Delete this API key permanently? The explanation on that dialog is Revoke this API key. Confirming removes the key. Anything still sending it receives 401. There is no second “revoke” button, and there is no way to turn a key off without deleting it.