# auth.md

Canonical URL: `https://epctex.com/auth.md`

You are an agent. This is the registration guide for epctex actors. An actor runs on Apify, and the credential that calls it is an Apify token. Read this file, then follow one method below. Do not invent a signup against this origin.

Audience: an agent calling `https://mcp.epctex.com/` or `https://api.apify.com/v2/actors/epctex~{actor}`. The documentation origin is `https://epctex.com`. The authorization server issuer is `https://console-backend.apify.com`.

Do not call `https://api.apify.com/v2/agent/auth`. This service does not accept an ID-JAG (`urn:ietf:params:oauth:token-type:id-jag`).

## Discover

1. [Protected resource metadata](https://epctex.com/.well-known/oauth-protected-resource)
2. [Authorization server metadata](https://epctex.com/.well-known/oauth-authorization-server), including `agent_auth`

`authorization_servers` and `issuer` are both `https://console-backend.apify.com`. The scope is `full_api_access`. Send the credential as `Authorization: Bearer`.

## Pick a method

1. A person can sign in to Apify. Use OAuth or an API token. Identity type `identity_assertion`, assertion type `verified_email`. Credential type `access_token` or `api_key`.
2. Nobody can sign in, and you can pay. Buy a prepaid API token. Identity type `anonymous`. Credential type `api_key`. There is no claim step.
3. Stop if you only have an ID-JAG. It will not be accepted.

`verified_email` means the person signs in to an Apify account. Do not POST an email address or a JWT to `register_uri`.

## User present

### API token

Credential type `api_key`.

1. The person opens https://console.apify.com/sign-up if they have no account.
2. They copy a token from https://console.apify.com/settings/integrations.
3. You send `Authorization: Bearer <token>`.

Runs are billed to that Apify account.

### OAuth

Credential type `access_token`. This is the claim ceremony.

1. Register a client at `register_uri`, https://console-backend.apify.com/oauth/apps. That URL is Apify's dynamic client registration. It is the same URL as `registration_endpoint`. It does not accept an auth.md identity-assertion body.
2. Send the person to `claim_uri`, https://console.apify.com/authorize/oauth. They sign in and approve. Use PKCE `S256`. Scope `full_api_access`.
3. Exchange the code at https://console-backend.apify.com/oauth/apps/token.
4. Send `Authorization: Bearer <access_token>`.

## Nobody present

Credential type `api_key`. Buy a prepaid, spend-capped token from https://agi.apify.com/protocols/x402/prepaid-tokens, then send it as `Authorization: Bearer <token>`. There is no claim step and no epctex account to create.
