---
title: "Save the Pi credential"
method: POST
path: "/api/v0beta1/secrets/pi"
tags: ["Secrets"]
---

# Save the Pi credential

`POST /api/v0beta1/secrets/pi`

Store the `~/.pi/agent/auth.json` contents to inject into every sandbox, replacing any credential already configured. Supply either a pasted blob (`authJson`) or one of the org's Claude/Codex API keys to convert into one (`source`); a converted credential is a snapshot, not a link, so rotating the key means converting again.

## Request body

- UpsertPiRequest
  - `authJson` string
  - `source` object
    - `agent` 'claude' | 'codex', required
    - `secretId` string, required

## Response `201`

Saved.

- PiStatus
  - `configured` boolean, required
  - `secretId` string, nullable

## Other responses

- `400` — Error
- `401` — Error
- `403` — Error
- `404` — Error

## Changes

- **2026-08-24** `837bdd763a48` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/amika/apis/amika-api/changes/api/v0beta1/secrets/pi/post.md)

---

[API](https://skmtc.dev/amika/apis/amika-api.md) · [All operations](https://skmtc.dev/amika/apis/amika-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/amika/amika-api/revisions/b63d287ac419/schema)
