canonical: https://jentic.com/apis/refd.ai/refd

# refd agent-facing API

The refd agent-facing API gives an agent read access to a workspace's AI visibility data: where a brand appears in AI-generated answers, which competitors appear instead, and the evidence behind each mention, citation, position, and score. It does this through a single stateless JSON-RPC 2.0 tool endpoint, where the agent lists the available read tools and a metric glossary at runtime and then calls them. The rest of the surface is the OAuth 2.1 machinery around it: protected-resource and authorization-server metadata, dynamic client registration, and an authorization-code flow with PKCE whose grant covers the workspaces chosen at consent.

## For AI agents

Read a workspace's AI-answer visibility data from refd by listing and calling its read tools over one JSON-RPC 2.0 endpoint, after an OAuth 2.1 PKCE grant scoped to the selected workspaces.

## Scope

Does not handle classic search rankings, backlink analysis, or ad campaign management. Use for reading a workspace's brand visibility in AI-generated answers only.

## Capabilities

- Discover the read tools a workspace grant exposes by sending a tools/list JSON-RPC request to POST /mcp
- Call a refd read tool with a tools/call request to pull brand mentions, citations, and positions in AI answers
- List the metric glossary with resources/list so the agent interprets refd scores correctly
- Register an OAuth client dynamically through POST `/oauth/register` before starting the consent flow
- Exchange an authorization code and code_verifier for an access token, or renew it with a refresh_token, at POST `/oauth/token`
- Read the OAuth protected-resource and authorization-server metadata to configure a client automatically

## Use cases

### AI visibility reporting agent through Jentic

A marketing agent that reports on AI search presence needs refd data without a developer hand-building the OAuth 2.1 PKCE flow. Through Jentic the agent searches for 'read my brand's AI answer visibility', loads POST /mcp with its JSON-RPC schema, sends tools/list to see the read tools the workspace grant allows, and then sends tools/call for the one it needs. The access token is injected at call time, and the agent turns the result into a summary of where the brand appeared and where a competitor took its place.

Example prompt: POST /mcp with {"jsonrpc":"2.0","id":1,"method":"tools/list"}, pick the tool that returns brand mentions, then POST /mcp with method tools/call for that tool and summarise the mentions and citations it returns

### Interpreting visibility scores with the metric glossary

Visibility scores mean little without their definitions. refd exposes a metric glossary as a resource on the same JSON-RPC endpoint, so an agent can send resources/list and read how each score, position, and citation metric is defined before it writes a report. That keeps a weekly summary consistent with how refd itself computes the numbers.

Example prompt: POST /mcp with method resources/list, read the metric glossary entry for the visibility score, and include its definition in the report footer

### Self-configuring OAuth client for refd

A developer connecting a new agent client to refd can let it configure itself. GET /.well-known/oauth-protected-resource/mcp names the authorization servers, GET /.well-known/oauth-authorization-server returns the endpoints, POST `/oauth/register` creates a client, and GET `/oauth/authorize` starts the PKCE flow that ends at a workspace consent screen. POST `/oauth/token` then exchanges the code and code_verifier for a token, and the refresh_token grant keeps it current.

Example prompt: GET /.well-known/oauth-authorization-server, POST `/oauth/register` to obtain a client_id, then POST `/oauth/token` with grant_type authorization_code, code, redirect_uri, client_id, and code_verifier

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | `/mcp` | JSON-RPC 2.0 tool endpoint |
| POST | `/oauth/token` | Exchange a code or refresh token for an access token |
| GET | `/oauth/authorize` | Start the authorization-code plus PKCE flow |
| POST | `/oauth/register` | Register an OAuth client dynamically |
| GET | `/.well-known/oauth-authorization-server` | Read authorization-server metadata |
| GET | `/health` | Liveness probe |

## Key resources

- **Tool endpoint** — Stateless JSON-RPC 2.0 endpoint for tools/list, tools/call, resources/list, and initialize, authorized by a workspace-scoped bearer token
- **OAuth flow** — Dynamic client registration, the authorization-code plus PKCE authorize step, and token exchange with refresh
- **Discovery metadata** — RFC 9728 protected-resource metadata and RFC 8414 authorization-server metadata
- **Health** — Liveness probe for the API

## AI readiness

This API is usable in Jentic One now. Its AI-readiness score against Jentic's framework shows where it stands today and where improvements would make it even easier for agents to use.

- **Score:** 46 / 100
- **Maturity:** Foundational
- **Dimensions:**
  - Foundational Compliance: 83 / 100
  - Developer Experience & Jentic Compatibility: 58 / 100
  - AI-Readiness & Agent Experience: 20 / 100
  - Agent Usability: 94 / 100
  - Security: 90 / 100
  - AI Discoverability: 84 / 100
- **View full report:** https://jentic.com/apis/refd.ai/refd/scorecard
- **How the score is calculated:** https://docs.jentic.com/reference/api-readiness-framework/overview/
- **More about the dimensions:** https://docs.jentic.com/reference/api-readiness-framework/specification/#dimensional-model-overview

### Score it yourself

Every API in the directory is allowlisted, so you can re-score it with no key required.

- **Score your own API:** https://jentic.com/scorecard.md
- **Scoring CLI agent skill:** https://github.com/jentic/jentic-api-scorecard/blob/main/skills/jentic-api-scorecard/SKILL.md

```sh
npx @jentic/api-scorecard-cli score <openapi-url>
```

## Why Jentic

- **Setup:** Wiring refd by hand means reading its OAuth discovery metadata, registering a client, running the authorization-code flow with PKCE, refreshing tokens, and then speaking JSON-RPC 2.0 to the tool endpoint. Through Jentic you install once, import refd from the API Directory, store the token once, and your agent calls it.
- **Permission scoping:** refd sends every data request through one JSON-RPC endpoint and names the tool inside the request body, so rules bound which operations your agent may call, not which refd tool it invokes. Limit the agent to the tool endpoint it needs; token-minting operations like client registration or token exchange are not included unless you add them.
- **Credential handling:** Your refd access token is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'read my brand's AI answer visibility', and Jentic returns the matching refd operation with its JSON-RPC input schema so the agent sends a well-formed request without browsing the reference docs.

## Related APIs

- **Semrush API** — Classic search engine rankings, keywords, and backlinks rather than presence in AI-generated answers
- **Ahrefs API** — Backlink, keyword, and organic search data for SEO analysis
- **serpstack API** — Real-time search engine result pages to compare against AI-answer visibility

## FAQ

### What authentication does the refd agent-facing API use?

Per its OpenAPI spec, the refd API secures POST /mcp with OAuth 2.1 authorization code plus PKCE, declared as the mcpOAuth scheme with the data:read scope. The discovery, registration, authorize, token, and health endpoints need no credential, since they are how a client obtains the token in the first place. Through Jentic, the resulting token is held encrypted by your own Jentic One instance and injected at call time.

### Is there a refd MCP server?

Yes - refd's agent interface is itself a remote MCP server over Streamable HTTP, and POST /mcp is that endpoint. You can also connect it through Jentic: your agent reaches the same endpoint without loading another server's tool definitions into its context, your OAuth token is injected at call time by your self-hosted instance instead of living in a client config file, and your rules decide which operations the agent may call.

### What are the rate limits for the refd API?

The OpenAPI spec states that the tool endpoint is rate-limited per token but does not give a number. Check the refd agent documentation at https://refd.ai/agents for current limits before scheduling frequent report runs.

### How do I pull brand visibility data from refd through Jentic?

Search Jentic for 'read my brand's AI answer visibility' to load POST /mcp, send a JSON-RPC request with method tools/list to see the read tools your grant allows, then send method tools/call with the chosen tool and its arguments. To run it on your own infrastructure, install Jentic One from its GitHub repo.

### Which workspaces can an agent read with a refd grant?

A refd grant covers the workspaces selected on the consent screen during the OAuth authorize step, or all of them if you choose that. The spec describes access as read-only by default, so a data:read token can read visibility data for those workspaces without changing it.

### Can I limit what my agent is allowed to do with the refd API?

Yes. Write a rule that allows only POST /mcp and leaves out the OAuth registration and token operations, so the agent can query visibility data with the token you stored but cannot register clients or mint new tokens. Workspace reach is set separately at OAuth consent, and every call the agent makes is logged.
