Skip to main content

How an agent gets an API key

You never copy a key into Jevlin. The binary registers itself with the search platform, receives a key, and starts searching. A person claims the agent afterwards to attach it to an account, and only the things that need an account wait for that.

This is what makes Jevlin installable by an agent, in a container, or in a script with nobody at a keyboard: the whole authentication path runs from the command line.

The flow​

YOUR AGENT'S MACHINE · NO BROWSERTHE PLATFORMA PERSON · LATER, OPTIONALjevlin setupor jevlin connectAgents APIagents-v1.jevlin.aiClaim pageplatform.jevlin.ai1 register, with no credential2 the key, shown once, and a claim link3 search works nowunclaimed tier, fast only; key in credentials.json4 the claim link and code are printed; a person opens it and approves the agentbound to an account: the scopes the person approved5 one poll after each search, or jevlin connectclaimed: every tier the project allows
  1. Register. jevlin setup, or jevlin connect on its own, sends one request to the platform's agents API with no credential at all. It may carry a name for the claim page and the client's version. Nothing in that request grants anything.
  2. Receive the key. The platform answers once with the agent's id, its sr- key, a claim link and code, and when the claim expires. The key is shown to the client once and stored in ~/.jevlin/credentials.json, owner-only. It is never put in a command line, an agent's config, or a skill.
  3. Search. From that moment jevlin search works, on the unclaimed tier described below. Your agent can use it before anyone opens a browser.
  4. Claim. connect prints the claim link and code. A person signs in at platform.jevlin.ai, or creates an account, and approves the agent, which binds it into their organization and a project. connect waits up to three minutes for that; if nobody claims it then, nothing is lost. Every later search starts one quiet background poll, so using the agent finishes the claim on its own, and a later jevlin connect does the same in the foreground.
  5. Settle. Once claimed, the agent carries the scopes the person approved. With the credits scope the agent searches on the account's credit at every tier the project allows. Searches stay on the fast tier until you choose another: when setup or connect sees the claim, it names balanced and max and the commands that choose one.
jevlin connect # register if needed, print the claim link, wait up to three minutes
jevlin status # the registration's status, scopes and the claim link on file

Before and after the claim​

unclaimedclaimed
searchworks, fast tier onlyevery tier the project allows; your tier applies
daily ceiling$0.10, about 76 fast searches at the economy pricethe account's credit
rate10 a minute, 120 an hour, 2 at a time120 a minute, 3,000 an hour, 16 at a time. See Rate limits and spend caps
trace retentionmetadata only (costs, providers and timings, no text), 30 daysthe account's setting, 30 days by default
key lifetimeexpires after 7 days if never claimeduntil revoked

An unclaimed key is enough to try Jevlin and to let an agent bootstrap itself. It is not enough to run on: claim it within the week.

The three states​

jevlin status names the registration's state, and the envelope's action field tells an agent what to do.

statemeaningwhat to do
unclaimedRegistered; waiting for a person. Search works on the unclaimed tier.Visit the claim link, or keep using the agent and let the background poll finish it.
claimedBound to an account, with its scopes.Nothing.
expiredNever claimed within its window. The key no longer works.Run jevlin connect: it registers a new agent with a new key.

An envelope with action: connect means the registration, the claim or a setup step needs attention; run jevlin connect or jevlin status -json to see which. action: login means a key exists and the router refused it; that is never fixed by registering again, which would mint a second agent. See the envelope.

Recovery​

  • The local record is lost or damaged but the key is still in credentials.json: jevlin connect asks the platform who the key belongs to and rebuilds the record. No person is involved.
  • The claim link is lost for an agent that is still unclaimed: a foreground jevlin connect asks the platform for a fresh code and prints it. The old code dies the moment the new one is minted. The link setup prints, and the unclaimed registration itself, last a week; a code minted this way is short-lived, about an hour and never past the key's own expiry, which is why only a connect you run does this, never the background poll.
  • The platform no longer recognizes the key: connect stops and says so. jevlin connect -force replaces the credential with a new registration. Run it only on purpose.
  • A second installation on another machine registers its own agent. Several agents can belong to one account; see Setup in detail for JEVLIN_HOME.

The API behind it​

Jevlin is one client of a public API, and an agent you write can use it the same way. The host is agents-v1.jevlin.ai; every route but the first takes the sr- key as a bearer token.

routewhat it does
POST /v1/agents/registerMints a key with no credential. Optional body: name (up to 64 characters), client (up to 128), requested_scopes (credits is the only scope a search uses; an unknown scope is 400 bad_scope). Answers 201 with agent_id, key, claim_url, claim_code, claim_expires_at and a poll interval. 503 with capacity when the unclaimed pool is full, or agents_disabled when registration is off.
GET /v1/agents/meThe agent's status, found by the key alone. How a lost record is rebuilt.
GET /v1/agents/{agent_id}The status poll: unclaimed, claimed or expired, the scopes, the claim expiry, and once claimed the project and its console URL. A key that does not belong to the agent answers 404, the same as an unknown one. The key of an agent that expired unclaimed still gets an answer here, so a client can learn expired and stop.
POST /v1/agents/{agent_id}/claim-codeA fresh claim link for a still-unclaimed agent: claim_url, claim_code and claim_expires_at, about an hour away and never past the key's own expiry. Kills the old code. A wrong key, or an agent already claimed or expired, answers 404.

The scope a search needs is credits. requested_scopes only pre-ticks a box on the claim page; the person decides. Errors carry a top-level code to branch on and a message for a person; never branch on the message.

curl -sS -X POST https://agents-v1.jevlin.ai/v1/agents/register \
-H 'Content-Type: application/json' -H 'User-Agent: my-tool/1.0' \
-d '{"name":"my-agent","client":"my-tool/1.0"}'
{"agent_id": "…", "key": "sr-…",
"claim_url": "https://platform.jevlin.ai/claim/AB12-CD34", "claim_code": "AB12-CD34",
"claim_expires_at": "…", "poll": {"url": "https://agents-v1.jevlin.ai/v1/agents/…", "interval_s": 5},
"tier": "unclaimed"}

The answer's key goes in Authorization: Bearer on every search to api.jevlin.ai; save it at once, since it is shown only this time. The claim_url is for a person to open, or they type the code at platform.jevlin.ai/claim; the code is single use, case-insensitive, and its hyphen is optional. Then poll poll.url with the key every interval_s, for a bounded time, until status is claimed:

curl -s https://agents-v1.jevlin.ai/v1/agents/<agent_id> -H "Authorization: Bearer sr-…"
{"agent_id": "…", "status": "claimed", "scopes": ["credits"], "claimed_at": "…",
"project_id": "…", "console_url": "https://platform.jevlin.ai/projects/…"}

Once claimed, console_url is the agent's project page on the platform: send a person there, never back to the claim link, whose code the claim used up. Registration allows 6 a minute per IP and answers 429 with Retry-After beyond that. These hosts sit behind Cloudflare, so send a real User-Agent. The search API itself is on HTTP API, and every error code on Errors.

Any other agent says what to paste so an agent uses Jevlin's binary instead of calling the API itself.

What leaves the machine​

Registration sends a name you chose and the client's version, nothing else. The key travels only to the router and to the agents API, both over HTTPS, and only in a header. The claim link is printed for a person and never opened by the binary. See What leaves the machine.