# Get prompt by id

**GET** `/v1/private/prompts/{id}`

Get prompt by id; when mask_id or environment is provided, requestedVersion is populated with the resolved version. mask_id and environment are mutually exclusive.

Base URL: `https://www.comet.com/opik/api`

Tags: `Prompts`

## Authorization

This operation requires no authorization.

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` (uuid) | Yes | — |

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `mask_id` | `string` (uuid) | No | Optional mask version id; when set, requestedVersion is the mask row for that id |
| `environment` | `string` | No | Optional environment name; when set, requestedVersion is the version mapped to that environment for the prompt |

## Responses

| Status | Description | Media type |
| --- | --- | --- |
| `200` | Prompt resource | `application/json` |
| `400` | Bad Request | `application/json` |
| `404` | Not Found | `application/json` |

### Example response: 200 — Prompt resource

```json
{
  "created_at": "2026-06-09T00:00:00Z",
  "created_by": "string",
  "description": "string",
  "id": "00000000-0000-0000-0000-000000000000",
  "last_updated_at": "2026-06-09T00:00:00Z",
  "last_updated_by": "string",
  "latest_version": {
    "change_description": "string",
    "commit": "string",
    "created_at": "2026-06-09T00:00:00Z",
    "created_by": "string",
    "environment": "string",
    "environments": [
      "string"
    ],
    "id": "00000000-0000-0000-0000-000000000000",
    "metadata": {},
    "prompt_id": "00000000-0000-0000-0000-000000000000",
    "tags": [
      "string"
    ],
    "template": "string",
    "template_structure": "chat",
    "type": "jinja2",
    "variables": [
      "string"
    ],
    "version_number": "string",
    "version_type": "mask"
  },
  "name": "string",
  "project_id": "00000000-0000-0000-0000-000000000000",
  "requested_version": {
    "change_description": "string",
    "commit": "string",
    "created_at": "2026-06-09T00:00:00Z",
    "created_by": "string",
    "environment": "string",
    "environments": [
      "string"
    ],
    "id": "00000000-0000-0000-0000-000000000000",
    "metadata": {},
    "prompt_id": "00000000-0000-0000-0000-000000000000",
    "tags": [
      "string"
    ],
    "template": "string",
    "template_structure": "chat",
    "type": "jinja2",
    "variables": [
      "string"
    ],
    "version_number": "string",
    "version_type": "mask"
  },
  "tags": [
    "string"
  ],
  "template_structure": "text",
  "version_count": 0
}
```

### Example response: 400 — Bad Request

```json
{
  "errors": [
    "string"
  ]
}
```

### Example response: 404 — Not Found

```json
{
  "errors": [
    "string"
  ]
}
```

## Related pages

- [Activate a pairing session](./activatepairingsession.md)
- [Add blueprint to existing config](./updateagentconfig.md)
- [Add items to annotation queue](./additemstoannotationqueue.md)
- [Add span comment](./addspancomment.md)
- [Add span feedback score](./addspanfeedbackscore.md)
- [Add thread comment](./addthreadcomment.md)
- [Add trace comment](./addtracecomment.md)
- [Add trace feedback score](./addtracefeedbackscore.md)
- [Agent Configs](./tags/agent-configs.md)
- [Agent Insights](./tags/agent-insights.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
