> ## Documentation Index
> Fetch the complete documentation index at: https://auth0.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Call First-Party APIs on User's Behalf

> Enable your AI agents to securely call first-party APIs on behalf of authenticated users.

A first-party API in Auth0 is owned and operated by your organization and [registered](https://auth0.com/docs/get-started/auth0-overview/set-up-apis.md) in the Auth0 Dashboard.

The user can grant your AI agent permission to access a first-party API on their behalf. After a user authenticates, Auth0 issues an access token scoped to the first-party API that contains the permissions granted by the user.

## How it works

The following diagram shows the delegated authorization flow for calling a first-party API:

![Authorization Flow](https://mintlify.s3.us-west-1.amazonaws.com/auth0/docs/images/ai/delegated_authorization_diagram_light.png)

Authorization Flow

**1. User authentication**

A user logs into your AI application or agent interface (e.g., via Universal
Login).

**2. Access token issuance**

After the user authenticates, Auth0 issues an access token to your
application.

**3. AI agent makes a tool call**

When the AI agent needs to access user-specific data or perform an action,
it makes a tool call to an API endpoint.

**4. Token obtained**

The access token obtained in step 2 is included in the API request
(typically in the `Authorization` header).

**5. API validation & response**

The API validates the access token. If valid, it processes the request on
the user's behalf and returns the response to the AI agent.

**6. AI agent receives and processes the information**

The AI agent uses this response to fulfill the user's request.

## Get started

To enable your AI agents to call your own APIs, refer to the following resources:

### Quickstarts

> **[Call First-Party APIs on User's Behalf](https://auth0.com/ai/docs/get-started/call-first-party-apis-on-users-behalf.md)**

### Sample Apps

> **[Fullstack (Next.js, FastAPI)](https://github.com/auth0-samples/auth0-ai-samples/tree/main/call-apis-on-users-behalf/your-api)**

> **[Agent0 (React + Fastify + Vercel AI SDK)](https://github.com/auth0-samples/agent0)**

> **[Assistant0 (Next.js, FastAPI)](https://github.com/auth0-samples/auth0-assistant0)**

## Learn more

> **[Auth0 Docs for APIs](https://auth0.com/docs/get-started/apis)**
