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

# Agents

> Act for an artist with a short-lived token from a 6-digit email code.

An agent can act for an artist without a long-lived API key. The artist reads the agent a 6-digit code from their email, and the agent exchanges it for a token that expires after 1 hour.

## Rules

* Ask the artist for the email they sign in with, then ask them to read you the code. Never ask for inbox access or a long-lived API key.
* Keep the token out of chat messages, logs and files.

> [!WARNING]
>
> Use the exact email the artist signs in with. Login signs up new users, so a code from any other email the artist owns creates a new, empty account.

## Log in

**1. Send the code**

```bash theme={null}
curl -X POST https://api.inprocess.world/api/oauth/code \
  -H "Content-Type: application/json" \
  -d '{"email": "artist@example.com"}'
```

**2. Log in with the code**

```bash theme={null}
curl -X POST https://api.inprocess.world/api/oauth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "artist@example.com", "code": "123456"}'
```

```json theme={null}
{
  "token": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9...",
  "social_wallet": "0x1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b"
}
```

The token lasts 1 hour and can't be refreshed. After that, requests are rejected; send a new code.

**3. Confirm the artist**

```bash theme={null}
curl https://api.inprocess.world/api/oauth \
  -H "Authorization: Bearer $TOKEN"
```

Check that `profile` is the expected artist before spending.

The artist can also copy an access token from [API keys](https://inprocess.world/manage/api-keys) in the app instead of reading you a code. It works the same way and expires at the time shown there.

## Collect a Moment

Call [`POST /moment/collect`](https://docs.inprocess.world/api-reference/moment/collect) with the token. It spends from the artist's smart wallet.

## Other endpoints

The token works on any endpoint that accepts a Bearer token. To add sign-in to your own app, see [Sign in with In•Process](https://docs.inprocess.world/guides/sign-in-with-in-process.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.