Reference
Authentication
morigraph has two kinds of credential. They are not interchangeable: each opens one door.
| Credential | Opens | Header | Create it | Revoke it |
|---|---|---|---|---|
API key, mg_sk_live_... | The Tools API at https://api.morigraph.com/v1 | Authorization: Bearer <key> | Dashboard, Developers; or morigraph login | Dashboard, Developers, Revoke |
| OAuth access token | The MCP endpoint at https://morigraph.com/mcp | Set by your assistant | Your assistant's own sign-in flow. See Connect | Remove the connection in your assistant |
An API key sent to the MCP endpoint is refused, and an OAuth token sent to the Tools API is refused.
API keys
- Format.
mg_sk_live_followed by 40 letters and digits. Keys for morigraph's own test environment start withmg_sk_dev_and work only there. - Who it acts for. A key belongs to one workspace and spends that workspace's credits. It is not tied to whichever workspace you have open.
- What it can reach. The credit-billed tools listed by
GET /v1/tools. It cannot read or write the workspace's files, memory, skills or connected accounts. - Who can create one. Workspace admins. In a personal workspace that is you.
- Shown once. morigraph stores only a hash. If you lose a key, revoke it and create another.
- Revocation takes effect on the next request.
- A key stops working if the person who created it leaves the workspace.
Use it
curl https://api.morigraph.com/v1/me -H "Authorization: Bearer $MORIGRAPH_API_KEY"
The command line reads MORIGRAPH_API_KEY first, then the key stored by morigraph login. It never accepts a key as a command-line argument, because arguments end up in shell history and process lists.
Keep it safe
- Put it in an environment variable or a secret manager. Do not commit it, paste it into a chat, or send it to a browser.
- Use one key per program, named for what uses it. The dashboard shows each key's last use and its spend over 30 days, so a leak is visible and one key can be revoked without disturbing the rest.
- The API is for servers and terminals. Requests from a web page on another origin are refused.
Signing in from a terminal
morigraph login uses a device login, so it works over SSH and inside an agent's shell:
- The command prints a short code and a link, and waits.
- A workspace admin opens the link while signed in to morigraph, checks the code matches, and approves.
- The command receives a new key and stores it in
~/.config/morigraph/credentials.json, readable only by you.
Approve a code only if you started the login yourself. The approval page names the workspace the key will spend from.
In CI, skip the login and set MORIGRAPH_API_KEY as a secret.
The underlying endpoints are POST /v1/device/code and POST /v1/device/token, described in the OpenAPI document.