Authentication
Register an agent identity, exchange it for an access token, mint API keys, sign in with Google, and optionally claim the account for a human.
Starcovery supports agentic registration through the auth.md protocol. An agent can register, receive a credential, and spend without a human present. A human can claim the account later. Humans can also sign up on the web and mint a Settings API key in Settings > API Keys.
Short path:
npx starcovery auth loginThis opens browser OAuth and saves a refreshable credential. For agentic registration without a human browser:
npx starcovery auth registerUse npx starcovery whoami to see the current credential, the bound user and organization, and whether the next search uses the user's free grant or the organization's prepaid credits.
The rest of this page describes agentic registration over HTTP.
Discover
On a 401 from a gated endpoint (campaigns, keys, billing), read the WWW-Authenticate header. It contains resource_metadata, which points at the Protected Resource Metadata document. The Model Context Protocol (MCP) endpoint answers 401 to a credential it cannot verify, and to a tools/call without a credential for any tool except search_creators and enrich_creators, with resource_metadata at /.well-known/oauth-protected-resource/api/mcp. You can also fetch the well-known URLs directly:
curl https://www.starcovery.com/.well-known/oauth-protected-resource
curl https://www.starcovery.com/.well-known/oauth-authorization-serverThe second document contains the agent_auth block. agent_auth.skill is the live auth.md protocol. agent_auth.agent_skill is the host SKILL.md. agent_auth.identity_endpoint and agent_auth.claim_endpoint are the registration and claim URLs below. identity_types_supported lists which registration methods the service accepts.
Use the anonymous identity type
The service accepts one identity type: anonymous. Other type values return 400 invalid_body.
Register anonymously
curl -X POST https://www.starcovery.com/agent/identity \
-H "content-type: application/json" \
-d '{"type": "anonymous"}'The response contains registration_id, a service-signed identity_assertion with assertion_expires, pre_claim_scopes, and claim materials: claim_url, claim_token, claim_token_expires, and post_claim_scopes.
The claim_token is returned once. Store it if a human may claim this identity later.
The claim_token and the identity_assertion expire 30 days after registration, at claim_token_expires and assertion_expires, whether or not a human claims the identity. Past that date the identity cannot be claimed or exchanged for an access token. A new registration is a new identity with its own organization, credits, and history. To keep a claimed account, its owner signs in and mints a Settings API key.
One client IP registers at most 10 times per rolling 24 hours, and registrations are capped at 100 per UTC day across every caller. Past either cap the endpoint returns 429 with error rate_limited; past the daily cap it does so even for a caller that has not registered that day.
Exchange the assertion for an access token
curl -X POST https://www.starcovery.com/oauth2/token \
-H "content-type: application/x-www-form-urlencoded" \
--data-urlencode "grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer" \
--data-urlencode "assertion=<identity_assertion>"The response is a bearer access_token with expires_in. When the access token expires, re-run the exchange with the same identity_assertion; the exchange returns no refresh token. The assertion works until assertion_expires, longer than one access token lasts.
Each exchange retires the previous token. Hold one token and re-fetch it when it expires.
Access tokens per registration are capped at 10 per rolling hour, the claim grant included. Past the cap the endpoint returns 429 with error rate_limited. Honor Retry-After.
Install the host skill
Install the Starcovery skill once a credential exists. npx starcovery auth register runs this installer for you. HTTP agents run the same installer. If bun is on PATH:
bunx skills add https://www.starcovery.com --global --yes --skill starcovery --agent cursor --agent claude-code --agent codexOtherwise:
npx -y skills add https://www.starcovery.com --global --yes --skill starcovery --agent cursor --agent claude-code --agent codexIf bunx, npx, or skills fails, the registration remains valid. Never write a token into the skill. Never write a project .cursor/skills directory by hand.
Claude Desktop has no skills CLI agent id. Download skill.zip and upload it at Customize > Skills with code execution on. MCP is a separate connector. See Connect over MCP.
Call the API
curl "https://www.starcovery.com/api/search?q=space+and+astronomy+explainers" \
-H "Authorization: Bearer <access_token>"The x-api-key header accepts the same token. MCP accepts the same credential. The MCP tools search_creators and enrich_creators also work without a credential, and every other MCP tool requires one. See Connect over MCP.
Claim ceremony (optional)
Run the claim only when a human wants to own the account:
curl -X POST https://www.starcovery.com/agent/identity/claim \
-H "content-type: application/json" \
-d '{"claim_token": "<claim_token>", "email": "<email_address>"}'The response contains a claim_attempt block with verification_uri, expires_in, and interval. Starcovery emails a one-time link to the supplied address. The link contains a one-time token. Starcovery uses control of that mailbox to verify a human identity.
Tell the person: open the emailed link. On that page they sign in with Google using that email address, then press Claim This Account. The account is then theirs.
Disposable, reserved, or undeliverable addresses return undeliverable_email before initiation.
Poll the token endpoint until it stops answering authorization_pending, honoring interval:
curl -X POST https://www.starcovery.com/oauth2/token \
-H "content-type: application/x-www-form-urlencoded" \
--data-urlencode "grant_type=urn:workos:agent-auth:grant-type:claim" \
--data-urlencode "claim_token=<claim_token>"The claim completes when the person presses Claim This Account, before your next poll. From that moment the pre-claim access tokens answer 401 and the pre-claim identity_assertion no longer exchanges. The next poll returns a post-claim access_token and a fresh identity_assertion. Use both from then on.
If the claim link window closes, call the claim endpoint again with the same claim_token and email address for a fresh link. The new link replaces the previous one immediately.
Claim initiation per registration is capped at 3 per rolling 24 hours. Past the cap the endpoint returns 429 with error rate_limited. Honor Retry-After.
Scopes
Registration returns pre_claim_scopes and post_claim_scopes. On this service they are the same set, so claiming leaves API access unchanged.
Claiming gives a human the account: sign-in, credit packs, and billing. The credential, credits, and history remain in place, and the user id stays the same.
Credential types
The following table lists who mints each credential and where it works.
| Credential | Who mints it | Where it works |
|---|---|---|
| Agent access token | POST /agent/identity and the token exchange | REST, MCP, CLI. No free search grant before the claim. |
| Settings API key | Humans, in Settings > API Keys | REST, MCP, CLI, including /api/keys. |
| OAuth access token | The OAuth flow of an MCP client or of starcovery auth login, after the consent screen | REST and MCP as Authorization: Bearer, never as x-api-key, and the CLI. Not /api/keys. |
| Browser session | Web sign-in with Google, or with email and password | web and same-origin API calls. |
Every credential is bound to one organization. Spend, campaign visibility, and API key ownership all follow that organization. MCP OAuth access tokens and /api/auth/oauth2/userinfo include an organization_id claim.
Authorization embeds the organization that is active at consent time, or the caller's first organization when none is active. An issued token stays bound to that organization when the session's active organization changes.
To bind a different organization, pick it under Give access to on the consent screen when you authorize. You can also switch the active organization from the Organizations menu in the app sidebar before you authorize. Then replace the token.
/api/keys is the only surface for creating, listing, and revoking Settings API keys. The Better Auth /api-key/create, /api-key/delete, /api-key/get, /api-key/list, /api-key/update, and /api-key/verify routes are disabled and respond 404. Send API key requests to /api/keys with a browser session or a Settings API key.
An owner or admin lists and revokes every key of the organization. A member lists and revokes only the keys that member minted, and a revoke of another member's key returns 404.
Humans sign in on the web with Google, or with an email address and a password at Sign in. A password account confirms its email address through a mailed link before it can sign in. Forgot password mails a reset link.
Google is a trusted Better Auth provider. If a Google account's verified email matches an existing user whose email is already verified, Starcovery links the Google identity to that account instead of creating a duplicate. This linking leaves agent access tokens, Settings API keys, and OAuth access tokens unchanged.
Docs playground
The API playground starts with no credential. Paste a Settings API key or an agent access token into its authentication panel.