---
title: "POST /model/{modelId}/invoke"
method: POST
path: "/model/{modelId}/invoke"
---

# POST /model/{modelId}/invoke

`POST /model/{modelId}/invoke`

Invokes the specified Amazon Bedrock model to run inference using the prompt and inference parameters provided in the request body. You use model inference to generate text, images, and embeddings.

For example code, see _Invoke model code examples_ in the _Amazon Bedrock User Guide_.

This operation requires permission for the `bedrock:InvokeModel` action.

To deny all inference access to resources that you specify in the modelId field, you need to deny access to the `bedrock:InvokeModel` and `bedrock:InvokeModelWithResponseStream` actions. Doing this also denies access to the resource through the Converse API actions ([Converse](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html) and [ConverseStream](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html)). For more information see [Deny access for inference on specific models](https://docs.aws.amazon.com/bedrock/latest/userguide/security_iam_id-based-policy-examples.html#security_iam_id-based-policy-examples-deny-inference).

For troubleshooting some of the common errors you might encounter when using the `InvokeModel` API, see [Troubleshooting Amazon Bedrock API Error Codes](https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html) in the Amazon Bedrock User Guide

## Path parameters

- `modelId` string, required

## Headers

- `Content-Type` string
- `Accept` string
- `X-Amzn-Bedrock-Trace` 'ENABLED' | 'DISABLED' | 'ENABLED_FULL'
- `X-Amzn-Bedrock-GuardrailIdentifier` string
- `X-Amzn-Bedrock-GuardrailVersion` string
- `X-Amzn-Bedrock-PerformanceConfig-Latency` 'standard' | 'optimized'
- `X-Amzn-Bedrock-Service-Tier` 'priority' | 'default' | 'flex' | 'reserved'
- `X-Amzn-Bedrock-Request-Metadata` string, password

## Request body

- object
  - `body` string, password — The prompt and inference parameters in the format specified in the <code>contentType</code> in the header. You must provide the body in JSON format. To see the format and content of the request and response bodies for different models, refer to <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters</a>. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html">Run inference</a> in the Bedrock User Guide.

## Response `200`

Success

- InvokeModelResponse
  - `body` string, password, required — Inference response from the model in the format specified in the <code>contentType</code> header. To see the format and content of the request and response bodies for different models, refer to <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters</a>.

## Other responses

- `480` — AccessDeniedException
- `481` — ResourceNotFoundException
- `482` — ThrottlingException
- `483` — ModelTimeoutException
- `484` — InternalServerException
- `485` — ServiceUnavailableException
- `486` — ValidationException
- `487` — ServiceQuotaExceededException
- `488` — ModelNotReadyException
- `489` — ModelErrorException

---

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