← Back to 1muse Developers

Quickstart

From an API key to a brokered call in about ten minutes. You will need Node 20 or newer.

1 · Scaffold the connector

npx @1muse/cli init

This writes 1muse.connector.json and asks which upstream you are wrapping. It does not ask for the credential — that arrives later, from your user, and goes straight into their vault.

2 · Declare a binding

Start with a read binding. It is the one that cannot cost anyone money if you get it wrong.

{
  "bindings": {
    "acme.invoice.list": {
      "call":  "GET /v2/invoices",
      "uses":  "acme_api_key",
      "scope": "read"
    }
  }
}

3 · Run the dev proxy

npx @1muse/cli dev

The proxy stands in for the broker locally and hits the real upstream, so you can exercise bindings before publishing anything. Credentials you use here live in a local vault that never syncs.

4 · Take a grant

Send your user to the hosted consent screen. They see the bindings by name, the limits, and the expiry — then their credential goes into their vault.

const url = await broker.grantUrl({
  subject:  "user_8812",
  bindings: ["acme.invoice.list"],
  expires:  "90d"
});

5 · Invoke it

const receipt = await broker.invoke({
  binding:    "acme.invoice.list",
  onBehalfOf: "user_8812"
});

 allowed · credential injected at the edge · ledger entry written

That is the whole loop. When you add a write binding, add a policy block at the same time — a cap and an approvalOver threshold are two lines and they are the difference between a bug and an incident.