API keys
An API key lets your scripts and automation use the Developer API on your own Motaware data. A key acts on the account that owns the project, and never on anyone else's. If your app works with other people's data, use Sign in with Motaware instead, so each person gives consent.
Create a key
- Open the console, choose a project and go to API keys.
- Name the key after where it will be used, such as "Nightly backup script".
-
Choose its permissions:
Permission Allows account.readReading your profile ( /v1/me) and your plan (/v1/me/plan) - Choose how long it lasts: 30 days, 90 days, 1 year, or no expiry.
The key is shown once. Motaware keeps only a hash of it, so it can't be shown again. If you lose a key, revoke it and create a new one.
Keep it secret
- Store keys in a secret manager or an environment variable.
- Never commit a key to source control, and never ship one inside an app, a mobile build or browser code.
- Every key starts with
mwk_, so secret scanners can recognize a leaked key. Revoke a leaked key right away.
Manage keys
- The console shows each key's first characters, its permissions, its expiry and when it was last used.
- Revoke a key at any time. It stops working within about 30 seconds.
- A project can have at most 20 active keys.
Examples
Each example calls GET /v1/me with the key read from the MOTAWARE_API_KEY environment variable.
curl
curl https://developerapi.motaware.com/v1/me \ -H "Authorization: Bearer $MOTAWARE_API_KEY"
Node.js (18+)
const res = await fetch("https://developerapi.motaware.com/v1/me", {
headers: { Authorization: `Bearer ${process.env.MOTAWARE_API_KEY}` },
});
if (!res.ok) throw new Error((await res.json()).error.message);
console.log(await res.json());
Python
import os, requests
r = requests.get(
"https://developerapi.motaware.com/v1/me",
headers={"Authorization": f"Bearer {os.environ['MOTAWARE_API_KEY']}"},
timeout=10,
)
r.raise_for_status()
print(r.json())
C#
using System.Net.Http.Headers;
using var http = new HttpClient { BaseAddress = new Uri("https://developerapi.motaware.com/") };
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("MOTAWARE_API_KEY"));
var me = await http.GetStringAsync("v1/me");
Console.WriteLine(me);