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

# 6. Use Priors with a personal key

> Create a personal key, verify it with GET /v2/me, list the agents your role reaches, and create an agent of your own.

This walkthrough is for calling Priors yourself from a script, notebook, or tool while you build. A personal key acts as you, with your role in one project, and reaches what you reach in the Priors app. It is not for production: your servers use a service-account key. See [Call Priors from your own backend](https://www.sapientpriors.com/docs/walkthroughs/call-from-your-backend.md).

| Step | Call | Success | Next |
| - | - | - | - |
| 1 | Project **API keys** page in the Priors app | Personal key (`spk_...`), shown once | Store securely |
| 2 | [GET`/v2/me`](https://www.sapientpriors.com/docs/api-reference/v2/users/get-me) | `200`, your user and organization | Verify identity |
| 3 | [GET`/v2/agents`](https://www.sapientpriors.com/docs/api-reference/v2/agents/list-agents) | `200`, `items` and `next_cursor` | List agents |
| 4 | [POST`/v2/agents`](https://www.sapientpriors.com/docs/api-reference/v2/agents/create-agent) | `202`, `initializing` | Poll until `ready` |

## Step 1: create a personal key

In the Priors app, pick the project you work in, open **API keys**, and choose **Create key**. Name it (for example `laptop`), choose a lifetime (30, 90, or 365 days, 90 by default), and confirm **For building and testing, not production**. You can hold up to 10 live personal keys across your organization's projects.

The key belongs to that project. It acts with your role there, and it never reaches another project. See [Roles and permissions](https://www.sapientpriors.com/docs/access/roles.md).

## Step 2: verify identity with `GET /v2/me`

```bash theme={null}
export SP_API_KEY="spk_7Kq2mN4pXr8wLz1c_a3f9…"

curl https://app.sapientpriors.com/api/v2/me \
  -H "Authorization: Bearer $SP_API_KEY"
```

```json theme={null}
{
  "user": {
    "user_id": "3f6c2a9e-8d41-5b7a-9c20-6e1f4d8b2a73",
    "email": "ada@example.com",
    "display_name": "Ada Lovelace"
  },
  "organization": {
    "organization_id": "org_01J...",
    "name": "Acme"
  },
  "api_key": {
    "key_id": "7Kq2mN4pXr8wLz1c",
    "project_id": "proj_01J...",
    "acts_as": { "type": "user", "id": "3f6c2a9e-8d41-5b7a-9c20-6e1f4d8b2a73" }
  }
}
```

Every response to a personal key carries `X-SP-Warning: personal API key, not for production`.

**If it fails:** `401 unauthorized` (wrong, revoked, or expired key, or you left the organization), `400 invalid_request` (you sent `X-SP-End-User`, or the request carried `Sec-Fetch-Site`), or `503 service_unavailable` (Priors could not confirm your membership; retry).

## Step 3: list the agents you reach

```bash theme={null}
curl "https://app.sapientpriors.com/api/v2/agents?limit=50" \
  -H "Authorization: Bearer $SP_API_KEY"
```

The list holds the agents your role reaches in the key's project: every public agent, and the private agents you created. A Project admin also sees every private agent in the project.

## Step 4: create an agent

```bash theme={null}
curl -X POST https://app.sapientpriors.com/api/v2/agents \
  -H "Authorization: Bearer $SP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_config": {
      "role": "Research notes",
      "objective": "Remember what I read and answer my questions from it."
    }
  }'
```

The agent lives in the key's project. If you are a Contributor or Agent admin, it is private: only you, Project admins, and Org admins reach it. If you are a Project admin or Org admin, it is public. See [Agents](https://www.sapientpriors.com/docs/concepts/agents.md).

Continue with [1. Your first agent, from start to finish](https://www.sapientpriors.com/docs/walkthroughs/first-conversation.md) to open a thread, teach the agent, and ask it questions.


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