Authentication
Every Pedra API request authenticates with an API key passed in the JSON body.
Getting an API key
- Sign up at app.pedra.ai.
- Open Settings → API.
- Copy your key. It's long-lived and tied to your account.
For higher quotas, dedicated capacity, or enterprise pricing, email felix@pedra.ai.
Building an agent? It can get a key for the person it works for by email, with their approval — see Accounts for AI agents.
Using the key
Pass the key as apiKey in the JSON request body for every endpoint. There is no header-based auth, OAuth flow, or token refresh — keys are long-lived and tied to your account.
Keeping your key safe
- Never ship keys in client-side code. Calls must originate from your backend. A key embedded in a browser bundle or mobile app is effectively public.
- Store keys as environment variables. Not in source control.
- Rotate immediately if leaked. Email us — we'll revoke the old key and issue a new one.
Errors
Missing or invalid keys return HTTP 404 with {"error": "User not found"} — Pedra looks the key up as a user record, so an unknown key reads as a missing user. See Errors & limits for the full list of failure modes.
Accounts for AI agents
An AI agent can get an API key for the person it works for — creating their Pedra account if they don't have one — without either of them opening Settings. It's for agents with no browser in the loop: Claude Code, a script, the local MCP server, anything that only speaks HTTP. The person approves from their inbox; the agent never sees a password.
ChatGPT and Claude connectors don't need this. Connecting Pedra there signs the person in with OAuth, and new users can create their account in that same sign-in tab. See MCP server.
- The agent calls
agent_signupwith the person's email. Pedra emails them a confirmation link, valid for 30 minutes. - The agent tells the person to check their email. They open the link: a new account says what they do, picks a language, chooses a password (8+ characters) and clicks Create account and allow; an existing account clicks Allow. They can also decline. Nothing is created until they click.
- Meanwhile the agent polls
agent_signup_statusevery 5 seconds. Once approved, the response has theapiKey— available for 15 minutes after approval, so store it. The key itself doesn't expire.
To keep this from being used to farm free accounts or spam inboxes: no account exists without a click in the inbox, disposable email domains are refused, requests are rate-limited per address and per IP, and the response is the same whether or not the address already has an account.
The whole flow, with a polling loop:
Request access
/api/agent_signupNo apiKey needed. Starts a request and emails the person the confirmation link. Returns a requestId to poll with.
emailstringrequiredagentNamestring400 — not a valid email address, or code: "disposable_email" (use a permanent address). 429 rate_limited — 3 requests an hour per address, 10 a day per IP, plus a global daily cap; the link already sent still works. 503 unavailable — signup by email is down; the person can sign up at app.pedra.ai and copy a key from Settings → API.
Response
Check an agent signup
/api/agent_signup_statusNo apiKey needed. Returns one of four statuses:
pending— the person hasn't clicked yet. Poll again in 5 seconds.approved— withapiKey,email,newAccount,plan,creditsRemainingandappUrl. A new account starts with Pedra's free trial credits. IfcreditsRemainingis 0 there's also anotesaying the person can get credits with a plan; pass it on. Free calls such as listing properties always work.denied— the person declined. Stop polling.expired— nobody clicked within 30 minutes, or the key wasn't collected within 15 minutes of approval. Start again withagent_signup. An unknownrequestIdreturns404.
requestIdstringrequired