Skip to content

Quickstart ​

From an OpenAPI spec to a tool call, with curl. Work in Staging; promote to Production when it works.

You need an account on app.frege.io (a new organization comes with a first project), curl and jq.

1. Get a token for yourself ​

People sign in with a one-time code sent by email. The code's answer is a bearer token for the API.

bash
curl -s -X POST https://api.frege.io/v1/auth/magic \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com"}'

# Then, with the six digits from the email:
TOKEN=$(curl -s -X POST https://api.frege.io/v1/auth/magic/verify \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com", "code": "123456"}' | jq -r .data.token)

The answer also carries a refresh_token; trade it at POST /v1/auth/refresh for a new token when this one expires.

2. Find your project ​

bash
ORG=$(curl -s https://api.frege.io/v1/orgs -H "Authorization: Bearer $TOKEN" | jq -r '.data.list[0].id')

PROJECT=$(curl -s "https://api.frege.io/v1/projects?org_id=$ORG" \
  -H "Authorization: Bearer $TOKEN" | jq -r '.data.list[0].id')

To make a new one: POST /v1/projects with {"name": "Shop", "org_id": "..."}.

3. Upload your spec to Staging ​

The body is the document itself, JSON or YAML, up to 5 MB. A spec upload must name its environment: there is no default, because an upload is live in its environment at once.

bash
curl -s -X POST "https://api.frege.io/v1/projects/$PROJECT/spec" \
  -H "Authorization: Bearer $TOKEN" \
  -H "X-Frege-Stage: staging" \
  --data-binary @openapi.yaml

servers[0].url in the spec must be an absolute http(s) address: every call goes there. An environment holds one spec; delete it (DELETE /v1/projects/{id}/spec) before uploading another. Check a file without storing it with POST /v1/projects/{id}/spec/validate. See Your OpenAPI spec.

4. Tell Frege how your users sign in ​

Tools run as a signed-in customer. Save a sign-in recipe (recipe.json) and test it against your real API:

bash
curl -s -X PUT "https://api.frege.io/v1/projects/$PROJECT/upstream/recipe" \
  -H "Authorization: Bearer $TOKEN" -H "X-Frege-Stage: staging" \
  -H "Content-Type: application/json" -d "{\"recipe\": $(cat recipe.json)}"

curl -s -X POST "https://api.frege.io/v1/projects/$PROJECT/upstream/recipe/test" \
  -H "Authorization: Bearer $TOKEN" -H "X-Frege-Stage: staging" \
  -H "Content-Type: application/json" -d '{}'

A recipe that asks the customer for something answers "status": "prompt"; send the answers back as input with the carry it returned. When the test connects, Frege keeps the credential on a test customer and returns its id as default_client_id. See Customer sign-in recipes.

5. Make an API key ​

A project API key lets your code list and run tools with no person signing in. It belongs to the environment it was made in, and the key itself is shown once.

bash
KEY=$(curl -s -X POST "https://api.frege.io/v1/projects/$PROJECT/api-keys" \
  -H "Authorization: Bearer $TOKEN" -H "X-Frege-Stage: staging" \
  -H "Content-Type: application/json" \
  -d '{"name": "quickstart"}' | jq -r .data.key)

6. List the tools and run one ​

bash
curl -s "https://api.frege.io/v1/projects/$PROJECT/operations" \
  -H "Authorization: Bearer $KEY" | jq '.data[] | {tool_name, method, path}'

curl -s -X POST "https://api.frege.io/v1/projects/$PROJECT/tools/listOrders/invoke" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"arguments": {"status": "open"}, "client_id": 42}'

client_id names the customer whose sign-in the call uses (the default_client_id from step 4, or any customer who signed in). The answer is your API's own response:

json
{"data": {"tool_name": "listOrders", "method": "GET", "url": "https://shop.example.com/orders?status=open",
  "status_code": 200, "body": "{\"orders\": []}"}}

7. Connect Claude ​

Every project has its own MCP address: https://<project id>.mcp.frege.io/staging/mcp for Staging. Add it in Claude as a custom connector (or claude mcp add --transport http shop <URL> in Claude Code), sign in as a user of your product, and ask Claude to use it. See MCP servers and sign-in.

8. Go to Production ​

POST /v1/projects/{id}/spec/promote copies Staging's spec and sign-in to Production. The customers' credentials are not copied. Production then needs its own API keys and a published MCP address (POST /v1/projects/{id}/mcp/publish with X-Frege-Stage: live).

Production changes are confirmed by a person. Publishing Production's address takes the confirm phrase and the emailed code from POST /v1/projects/{id}/mcp/publish-code. Promoting over a spec Production already serves takes the same pair from POST /v1/projects/{id}/spec/change-code. Both answers carry the exact confirm phrase to send back.