---
title: "Mint a grant for one source [write]"
method: POST
path: "/traces/{id}/grants"
tags: ["traces"]
---

# Mint a grant for one source \[write\]

`POST /traces/{id}/grants`

## Request

- Base URL: `https://api.agentsky.dev/v1`
- URL: `https://api.agentsky.dev/v1/traces/{id}/grants`
- Auth: HTTP bearer

The token (tgr_…) is shown once. It may only add events to this trace, as this source, in the content scopes it names, until it expires (default 24 hours, at most 7 days, never past the trace). Returns 404 when the TASK_TRACES switch is off for the workspace and 503 not_migrated before the tables exist.

## Path parameters

- `id` string, required

## Request body

- object
  - `source` string, required
  - `ttl_seconds` integer
  - `content_scopes` string[]: Content the source may send beside metadata; omitted admits metadata only

## Response `201`

Created

- object
  - `grant` TaskTraceGrant, required
    - `id` string, required: tgrant_…
    - `trace_id` string, required
    - `source` string, required: The one source this grant may report as
    - `content_scopes` string[]: The content this grant admits beside metadata; empty admits metadata only
    - `expires_at` string, date-time, required
    - `revoked_at` string, date-time, nullable, required
    - `created_at` string, date-time, required
  - `token` string, required

## Other responses

- `default`: Error — { error: { code, message } }

## Changes

- **2026-11-02** `e5e8f0229a99`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/agentsky/apis/agentsky-developer-api/changes/traces/:id/grants/post.md)

---

[API](https://skmtc.dev/agentsky/apis/agentsky-developer-api.md) - [All operations](https://skmtc.dev/agentsky/apis/agentsky-developer-api/llms.txt) - [OpenAPI document](https://skmtc.dev/agentsky/apis/agentsky-developer-api/revisions/0d435187cd55?raw)
