Skip to main content

Prompts API

Endpoints for fetching prompt versions. The SDK uses these endpoints to retrieve prompt content by name.

All endpoints require a valid JWT bearer token obtained from the authentication endpoint.

Request Headers

The SDK sends the following headers with every request:

Accept: application/json
Authorization: Bearer {access_token}
User-Agent: scope-client-python/0.1.0
X-Request-ID: {uuid}
HeaderDescription
AcceptAlways application/json
AuthorizationJWT bearer token from /v1/auth/sdk-token
User-AgentSDK identifier and version (e.g., scope-client-python/0.1.0 or scope-client-ruby/0.1.0)
X-Request-IDUnique UUID for request tracing

Get Production Version

GET /api/v1/prompts/{name}/production

Returns the currently published (production) version of a prompt.

Path Parameters:

ParameterTypeDescription
namestringPrompt name

Response: 200 OK

{
"prompt_id": "pmt_01ABC",
"version_id": "v_01DEF",
"name": "greeting",
"version": 3,
"content": "Hello, {{name}}!",
"variables": ["name"],
"status": "published",
"is_production": true,
"prompt_type": "text",
"metadata": {},
"tags": ["demo"],
"created_at": "2024-01-20T14:00:00Z",
"updated_at": "2024-01-20T15:00:00Z",
"promoted_at": "2024-01-20T15:00:00Z",
"promoted_by": "usr_01XYZ"
}

Errors: 401, 403, 404 (prompt not found or no production version), 500


Get Latest Version

GET /api/v1/prompts/{name}/latest

Returns the most recent version of a prompt regardless of status.

Path Parameters:

ParameterTypeDescription
namestringPrompt name

Response: 200 OK

{
"prompt_id": "pmt_01ABC",
"version_id": "v_01GHI",
"name": "greeting",
"version": 4,
"content": "Hello, {{name}}! Welcome to {{app}}.",
"variables": ["name", "app"],
"status": "draft",
"is_production": false,
"prompt_type": "text",
"metadata": {},
"tags": ["demo"],
"created_at": "2024-01-22T10:00:00Z",
"updated_at": "2024-01-22T10:00:00Z",
"promoted_at": null,
"promoted_by": null
}

Errors: 401, 403, 404, 500


Get Specific Version

GET /api/v1/prompts/{name}/versions/{versionId}

Returns a specific version by ID.

Path Parameters:

ParameterTypeDescription
namestringPrompt name
versionIdstringVersion identifier

Response: 200 OK

{
"prompt_id": "pmt_01ABC",
"version_id": "v_01DEF",
"name": "greeting",
"version": 3,
"content": "Hello, {{name}}!",
"variables": ["name"],
"status": "published",
"is_production": true,
"prompt_type": "text",
"metadata": {},
"tags": ["demo"],
"created_at": "2024-01-20T14:00:00Z",
"updated_at": "2024-01-20T15:00:00Z",
"promoted_at": "2024-01-20T15:00:00Z",
"promoted_by": "usr_01XYZ"
}

Errors: 401, 403, 404, 500


Response Schema

All three endpoints return a PromptVersion object with the following fields:

FieldTypeDescription
prompt_idstringPrompt identifier
version_idstringVersion identifier
namestringPrompt name
versionintegerVersion number
contentstringPrompt content with {{variable}} placeholders
variablesstring[]Extracted variable names from content
statusstringdraft, published, or archived
is_productionbooleanWhether this version is the current production version
prompt_typestringtext or chat
metadataobjectArbitrary key-value metadata
tagsstring[]Tags for organization
created_atdatetimeWhen the version was created
updated_atdatetimeWhen the version was last updated
promoted_atdatetime | nullWhen the version was promoted to production
promoted_bystring | nullUser who promoted the version
Was this page helpful?