Prompt Templates

The /prompts endpoint allows you to manage your Prompt Templates.

Retrieve a Prompt Template

Endpoint: /prompts/<PT_ID>

Method: GET

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterData TypeDescription
PT_IDstringThe ID of the Prompt Template to retrieve.

Example Request

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/prompts/<PT_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Example Response

{
    "id": "<PT_ID>",
    "name": "My Prompt Template",
    "role": "user",
    "status": "draft",
    "version": 1,
    "description": "This is my prompt template.",
    "content_type": "text",
    "content": "This is the content of my prompt template.",
    "test_data": {
        "foo": "bar"
    },
    "inputSchema": {
        "type": "object",
        "properties": {
            "foo": {
                "type": "string"
            }
        },
        "required": [
            "foo"
        ]
    },
    "project": "<PROJECT_ID>",
    "tags": [
        "tag1",
        "tag2"
    ],
    "created_by": "user:64684c71c12e5a2a3a123456",
    "updated_by": "user:64684c71c12e5a2a3a123456",
    "created_at": "2023-05-24T14:24:01.729Z",
    "updated_at": "2023-05-24T14:24:01.729Z"
}

Code Examples

Retrieve a Prompt Template

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/prompts/<PT_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

List Prompt Templates

Endpoint: /prompts

Method: GET

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Query Parameters

ParameterData TypeDescription
namestringThe name of the Prompt Template to filter by.
rolestringThe role of the Prompt Template to filter by.

Example Request

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/prompts?name=My%20Prompt%20Template&role=user' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Example Response

[
    {
        "id": "<PT_ID>",
        "name": "My Prompt Template",
        "description": "This is my prompt template.",
        "role": "user",
        "status": "draft",
        "created_at": "2023-05-24T14:24:01.729Z",
        "updated_at": "2023-05-24T14:24:01.729Z",
        "interactions": [
            {
                "id": "646e644ec12e5a2a3a875b8c",
                "name": "My Interaction",
                "versions": [
                    {
                        "versions": 1
                    }
                ]
            }
        ],
        "version": 1
    }
]

Code Examples

List Prompt Templates

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/prompts?name=My%20Prompt%20Template&role=user' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Create a Prompt Template

Endpoint: /prompts

Method: POST

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Input Parameters

ParameterData TypeDescription
namestringThe name of the Prompt Template.
rolestringThe role of the Prompt Template.
descriptionstringThe description of the Prompt Template.
content_typestringThe content type of the Prompt Template.
contentstringThe content of the Prompt Template.
test_dataobjectThe test data for the Prompt Template.
inputSchemaobjectThe input schema for the Prompt Template.
tagsstring[]The tags for the Prompt Template.

Example Request

{
    "name": "My Prompt Template",
    "role": "user",
    "description": "This is my prompt template.",
    "content_type": "text",
    "content": "This is the content of my prompt template.",
    "test_data": {
        "foo": "bar"
    },
    "inputSchema": {
        "type": "object",
        "properties": {
            "foo": {
                "type": "string"
            }
        },
        "required": [
            "foo"
        ]
    },
    "tags": [
        "tag1",
        "tag2"
    ]
}

Example Response

{
    "id": "<PT_ID>",
    "name": "My Prompt Template",
    "role": "user",
    "status": "draft",
    "version": 1,
    "description": "This is my prompt template.",
    "content_type": "text",
    "content": "This is the content of my prompt template.",
    "test_data": {
        "foo": "bar"
    },
    "inputSchema": {
        "type": "object",
        "properties": {
            "foo": {
                "type": "string"
            }
        },
        "required": [
            "foo"
        ]
    },
    "project": "<PROJECT_ID>",
    "tags": [
        "tag1",
        "tag2"
    ],
    "created_by": "user:64684c71c12e5a2a3a123456",
    "updated_by": "user:64684c71c12e5a2a3a123456",
    "created_at": "2023-05-24T14:24:01.729Z",
    "updated_at": "2023-05-24T14:24:01.729Z"
}

Code Examples

Create a Prompt Template

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/prompts' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "My Prompt Template",
    "role": "user",
    "description": "This is my prompt template.",
    "content_type": "text",
    "content": "This is the content of my prompt template.",
    "test_data": {
        "foo": "bar"
    },
    "inputSchema": {
        "type": "object",
        "properties": {
            "foo": {
                "type": "string"
            }
        },
        "required": [
            "foo"
        ]
    },
    "tags": [
        "tag1",
        "tag2"
    ]
}'

Update a Prompt Template

Endpoint: /prompts/<PT_ID>

Method: PUT

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterData TypeDescription
PT_IDstringThe ID of the Prompt Template to update.

Input Parameters

ParameterData TypeDescription
namestringThe name of the Prompt Template.
rolestringThe role of the Prompt Template.
descriptionstringThe description of the Prompt Template.
content_typestringThe content type of the Prompt Template.
contentstringThe content of the Prompt Template.
test_dataobjectThe test data for the Prompt Template.
inputSchemaobjectThe input schema for the Prompt Template.
tagsstring[]The tags for the Prompt Template.

Example Request

{
    "name": "My Updated Prompt Template",
    "role": "assistant",
    "description": "This is my updated prompt template.",
    "content_type": "text",
    "content": "This is the updated content of my prompt template.",
    "test_data": {
        "foo": "baz"
    },
    "inputSchema": {
        "type": "object",
        "properties": {
            "foo": {
                "type": "string"
            }
        },
        "required": [
            "foo"
        ]
    },
    "tags": [
        "tag3",
        "tag4"
    ]
}

Example Response

{
    "id": "<PT_ID>",
    "name": "My Updated Prompt Template",
    "role": "assistant",
    "status": "draft",
    "version": 2,
    "description": "This is my updated prompt template.",
    "content_type": "text",
    "content": "This is the updated content of my prompt template.",
    "test_data": {
        "foo": "baz"
    },
    "inputSchema": {
        "type": "object",
        "properties": {
            "foo": {
                "type": "string"
            }
        },
        "required": [
            "foo"
        ]
    },
    "project": "<PROJECT_ID>",
    "tags": [
        "tag3",
        "tag4"
    ],
    "created_by": "user:64684c71c12e5a2a3a123456",
    "updated_by": "user:64684c71c12e5a2a3a123456",
    "created_at": "2023-05-24T14:24:01.729Z",
    "updated_at": "2023-05-24T14:28:17.341Z"
}

Code Examples

Update a Prompt Template

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/prompts/<PT_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "My Updated Prompt Template",
    "role": "assistant",
    "description": "This is my updated prompt template.",
    "content_type": "text",
    "content": "This is the updated content of my prompt template.",
    "test_data": {
        "foo": "baz"
    },
    "inputSchema": {
        "type": "object",
        "properties": {
            "foo": {
                "type": "string"
            }
        },
        "required": [
            "foo"
        ]
    },
    "tags": [
        "tag3",
        "tag4"
    ]
}'

Delete a Prompt Template

Endpoint: /prompts/<PT_ID>

Method: DELETE

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterData TypeDescription
PT_IDstringThe ID of the Prompt Template to delete.

Example Request

curl --location --request DELETE 'https://studio-server-production.api.becomposable.com/api/v1/prompts/<PT_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Example Response

{
    "id": "<PT_ID>"
}

Code Examples

Delete a Prompt Template

curl --location --request DELETE 'https://studio-server-production.api.becomposable.com/api/v1/prompts/<PT_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Fork a Prompt Template

Endpoint: /prompts/<PT_ID>/fork

Method: POST

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterData TypeDescription
PT_IDstringThe ID of the Prompt Template to fork.

Input Parameters

ParameterData TypeDescription
keepTagsbooleanWhether to keep the tags from the original Prompt Template.
targetProjectstringThe ID of the project to fork the Prompt Template to.

Example Request

{
    "keepTags": true,
    "targetProject": "<PROJECT_ID>"
}

Example Response

{
    "id": "<PT_ID>",
    "name": "My Prompt Template (fork)",
    "role": "user",
    "status": "draft",
    "version": 1,
    "description": "This is my prompt template.",
    "content_type": "text",
    "content": "This is the content of my prompt template.",
    "test_data": {
        "foo": "bar"
    },
    "inputSchema": {
        "type": "object",
        "properties": {
            "foo": {
                "type": "string"
            }
        },
        "required": [
            "foo"
        ]
    },
    "project": "<PROJECT_ID>",
    "tags": [
        "tag1",
        "tag2"
    ],
    "parent": "<PT_ID>",
    "created_by": "user:64684c71c12e5a2a3a123456",
    "updated_by": "user:64684c71c12e5a2a3a123456",
    "created_at": "2023-05-24T14:34:16.908Z",
    "updated_at": "2023-05-24T14:34:16.908Z"
}

Code Examples

Fork a Prompt Template

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/prompts/<PT_ID>/fork' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "keepTags": true,
    "targetProject": "<PROJECT_ID>"
}'

List Prompt Template Versions

Endpoint: /prompts/<PT_ID>/versions

Method: GET

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterData TypeDescription
PT_IDstringThe ID of the Prompt Template to list versions for.

Example Request

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/prompts/<PT_ID>/versions' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Example Response

[
    {
        "id": "<PT_ID>",
        "name": "My Prompt Template",
        "description": "This is my prompt template.",
        "status": "published",
        "version": 1,
        "latest": false,
        "created_at": "2023-05-24T14:24:01.730Z",
        "updated_at": "2023-05-24T14:24:01.730Z"
    }
]

Code Examples

List Prompt Template Versions

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/prompts/<PT_ID>/versions' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

List Prompt Template Forks

Endpoint: /prompts/<PT_ID>/forks

Method: GET

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterData TypeDescription
PT_IDstringThe ID of the Prompt Template to list forks for.

Example Request

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/prompts/<PT_ID>/forks' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Example Response

[
    {
        "name": "My Prompt Template (fork)",
        "description": "This is my prompt template.",
        "status": "draft",
        "version": 1,
        "latest": true,
        "created_at": "2023-05-24T14:34:16.908Z",
        "updated_at": "2023-05-24T14:34:16.908Z",
        "id": "<PT_ID>"
    }
]

Code Examples

List Prompt Template Forks

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/prompts/<PT_ID>/forks' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Compute Prompt Template Facets

Endpoint: /prompts/facets

Method: POST

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Input Parameters

ParameterData TypeDescription
facetsFacetSpec[]The facets to compute.
queryPromptSearchQueryThe query to filter the facets by.

Example Request

{
    "facets": [
        {
            "name": "role",
            "field": "role"
        }
    ],
    "query": {
        "name": "My Prompt Template"
    }
}

Example Response

{
    "role": [
        {
            "_id": "user",
            "count": 1
        }
    ],
    "total": 1
}

Code Examples

Compute Prompt Template Facets

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/prompts/facets' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "facets": [
        {
            "name": "role",
            "field": "role"
        }
    ],
    "query": {
        "name": "My Prompt Template"
    }
}'

List Prompt Template Interactions

Endpoint: /prompts/<PT_ID>/interactions

Method: GET

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterData TypeDescription
PT_IDstringThe ID of the Prompt Template to list interactions for.

Example Request

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/prompts/<PT_ID>/interactions' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Example Response

{
    "prompt": "<PT_ID>",
    "interactions": [
        {
            "id": "<INTERACTION_ID>",
            "name": "My Interaction",
            "versions": [
                {
                    "versions": 1
                }
            ]
        }
    ]
}

Code Examples

List Prompt Template Interactions

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/prompts/<PT_ID>/interactions' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Was this page helpful?