---
title: "POST /prompts/"
method: POST
path: "/prompts/"
---

# POST /prompts/

`POST /prompts/`

Creates a prompt in your prompt library that you can add to a flow. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management.html">Prompt management in Amazon Bedrock</a>, <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management-create.html">Create a prompt using Prompt management</a> and <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/flows.html">Prompt flows in Amazon Bedrock</a> in the Amazon Bedrock User Guide.

## Request body

- object
  - `name` string, required — A name for the prompt.
  - `description` string — A description for the prompt.
  - `customerEncryptionKeyArn` string — The Amazon Resource Name (ARN) of the KMS key to encrypt the prompt.
  - `defaultVariant` string — The name of the default variant for the prompt. This value must match the <code>name</code> field in the relevant <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptVariant.html">PromptVariant</a> object.
  - `variants` PromptVariant[] — A list of objects, each containing details about a variant of the prompt.
    - `name` string, required — The name of the prompt variant.
    - `templateType` 'TEXT' | 'CHAT', required — The type of prompt template to use.
    - `templateConfiguration` object, required — Contains configurations for the prompt template.
      - `text` object — Contains configurations for the text in a message for a prompt.
        - `text` string, password, required — The message for the prompt.
        - `cachePoint` object — A cache checkpoint within a template configuration.
          - `type` 'default', required — Indicates that the CachePointBlock is of the default type
        - `inputVariables` PromptInputVariable[] — An array of the variables in the prompt template.
          - `name` string — The name of the variable.
      - `chat` object — Contains configurations to use the prompt in a conversational format.
        - `messages` Message[], required — Contains messages in the chat for the prompt.
          - `role` 'user' | 'assistant', required — The role that the message belongs to.
          - `content` ContentBlock[], required — The content in the message.
            - `text` string — The text in the message.
            - `cachePoint` object — Creates a cache checkpoint within a message.
              - …
        - `system` SystemContentBlock[] — Contains system prompts to provide context to the model or to describe how it should behave.
          - `text` string — The text in the system prompt.
          - `cachePoint` object — Creates a cache checkpoint within a tool designation
            - `type` 'default', required — Indicates that the CachePointBlock is of the default type
        - `inputVariables` PromptInputVariable[] — An array of the variables in the prompt template.
          - `name` string — The name of the variable.
        - `toolConfiguration` object — Configuration information for the tools that the model can use when generating a response.
          - `tools` Tool[], required — An array of tools to pass to a model.
            - `toolSpec` object — The specification for the tool.
              - …
            - `cachePoint` object — Creates a cache checkpoint within a tool designation
              - …
          - `toolChoice` object — Defines which tools the model should request when invoked.
            - `auto` object — Defines tools. The model automatically decides whether to call a tool or to generate text instead.
            - `any` object — Defines tools, at least one of which must be requested by the model. No text is generated but the results of tool use are sent back to the model to help generate a response.
            - `tool` object — Defines a specific tool that the model must request. No text is generated but the results of tool use are sent back to the model to help generate a response.
              - …
    - `modelId` string — The unique identifier of the model or <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html">inference profile</a> with which to run inference on the prompt.
    - `inferenceConfiguration` object — Contains inference configurations for the prompt variant.
      - `text` object — Contains inference configurations for a text prompt.
        - `temperature` number, float — Controls the randomness of the response. Choose a lower value for more predictable outputs and a higher value for more surprising outputs.
        - `topP` number, float — The percentage of most-likely candidates that the model considers for the next token.
        - `maxTokens` integer — The maximum number of tokens to return in the response.
        - `stopSequences` String[] — A list of strings that define sequences after which the model will stop generating.
    - `metadata` PromptMetadataEntry[] — An array of objects, each containing a key-value pair that defines a metadata tag and value to attach to a prompt variant.
      - `key` string, password, required — The key of a metadata tag for a prompt variant.
      - `value` string, password, required — The value of a metadata tag for a prompt variant.
    - `additionalModelRequestFields` object — Contains model-specific inference configurations that aren't in the <code>inferenceConfiguration</code> field. To see model-specific inference parameters, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference request parameters and response fields for foundation models</a>.
    - `genAiResource` object — Specifies a generative AI resource with which to use the prompt.
      - `agent` object — Specifies an Amazon Bedrock agent with which to use the prompt.
        - `agentIdentifier` string, required — The ARN of the agent with which to use the prompt.
  - `clientToken` string — A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.
  - `tags` object — Any tags that you want to attach to the prompt. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/tagging.html">Tagging resources in Amazon Bedrock</a>.

## Response `201`

Success

- CreatePromptResponse
  - `name` string, required — The name of the prompt.
  - `description` string — The description of the prompt.
  - `customerEncryptionKeyArn` string — The Amazon Resource Name (ARN) of the KMS key that you encrypted the prompt with.
  - `defaultVariant` string — The name of the default variant for your prompt.
  - `variants` PromptVariant[] — A list of objects, each containing details about a variant of the prompt.
    - `name` string, required — The name of the prompt variant.
    - `templateType` 'TEXT' | 'CHAT', required — The type of prompt template to use.
    - `templateConfiguration` object, required — Contains configurations for the prompt template.
      - `text` object — Contains configurations for the text in a message for a prompt.
        - `text` string, password, required — The message for the prompt.
        - `cachePoint` object — A cache checkpoint within a template configuration.
          - `type` 'default', required — Indicates that the CachePointBlock is of the default type
        - `inputVariables` PromptInputVariable[] — An array of the variables in the prompt template.
          - `name` string — The name of the variable.
      - `chat` object — Contains configurations to use the prompt in a conversational format.
        - `messages` Message[], required — Contains messages in the chat for the prompt.
          - `role` 'user' | 'assistant', required — The role that the message belongs to.
          - `content` ContentBlock[], required — The content in the message.
            - `text` string — The text in the message.
            - `cachePoint` object — Creates a cache checkpoint within a message.
              - …
        - `system` SystemContentBlock[] — Contains system prompts to provide context to the model or to describe how it should behave.
          - `text` string — The text in the system prompt.
          - `cachePoint` object — Creates a cache checkpoint within a tool designation
            - `type` 'default', required — Indicates that the CachePointBlock is of the default type
        - `inputVariables` PromptInputVariable[] — An array of the variables in the prompt template.
          - `name` string — The name of the variable.
        - `toolConfiguration` object — Configuration information for the tools that the model can use when generating a response.
          - `tools` Tool[], required — An array of tools to pass to a model.
            - `toolSpec` object — The specification for the tool.
              - …
            - `cachePoint` object — Creates a cache checkpoint within a tool designation
              - …
          - `toolChoice` object — Defines which tools the model should request when invoked.
            - `auto` object — Defines tools. The model automatically decides whether to call a tool or to generate text instead.
            - `any` object — Defines tools, at least one of which must be requested by the model. No text is generated but the results of tool use are sent back to the model to help generate a response.
            - `tool` object — Defines a specific tool that the model must request. No text is generated but the results of tool use are sent back to the model to help generate a response.
              - …
    - `modelId` string — The unique identifier of the model or <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html">inference profile</a> with which to run inference on the prompt.
    - `inferenceConfiguration` object — Contains inference configurations for the prompt variant.
      - `text` object — Contains inference configurations for a text prompt.
        - `temperature` number, float — Controls the randomness of the response. Choose a lower value for more predictable outputs and a higher value for more surprising outputs.
        - `topP` number, float — The percentage of most-likely candidates that the model considers for the next token.
        - `maxTokens` integer — The maximum number of tokens to return in the response.
        - `stopSequences` String[] — A list of strings that define sequences after which the model will stop generating.
    - `metadata` PromptMetadataEntry[] — An array of objects, each containing a key-value pair that defines a metadata tag and value to attach to a prompt variant.
      - `key` string, password, required — The key of a metadata tag for a prompt variant.
      - `value` string, password, required — The value of a metadata tag for a prompt variant.
    - `additionalModelRequestFields` object — Contains model-specific inference configurations that aren't in the <code>inferenceConfiguration</code> field. To see model-specific inference parameters, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference request parameters and response fields for foundation models</a>.
    - `genAiResource` object — Specifies a generative AI resource with which to use the prompt.
      - `agent` object — Specifies an Amazon Bedrock agent with which to use the prompt.
        - `agentIdentifier` string, required — The ARN of the agent with which to use the prompt.
  - `id` string, required — The unique identifier of the prompt.
  - `arn` string, required — The Amazon Resource Name (ARN) of the prompt.
  - `version` string, required — The version of the prompt. When you create a prompt, the version created is the <code>DRAFT</code> version.
  - `createdAt` string, date-time, required — The time at which the prompt was created.
  - `updatedAt` string, date-time, required — The time at which the prompt was last updated.

## Other responses

- `480` — ThrottlingException
- `481` — AccessDeniedException
- `482` — ValidationException
- `483` — InternalServerException
- `484` — ConflictException
- `485` — ServiceQuotaExceededException

---

[API](https://skmtc.net/aws/apis/bedrock-agent.md) · [All operations](https://skmtc.net/aws/apis/bedrock-agent/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/bedrock-agent/versions/a3b2356f17da/schema)
