---
title: "POST /2015-03-31/functions/{FunctionName}/invocations"
method: POST
path: "/2015-03-31/functions/{FunctionName}/invocations"
---

# POST /2015-03-31/functions/{FunctionName}/invocations

`POST /2015-03-31/functions/{FunctionName}/invocations`

Invokes a Lambda function. You can invoke a function synchronously (and wait for the response), or asynchronously. To invoke a function asynchronously, set `InvocationType` to `Event`.

For [synchronous invocation](https://docs.aws.amazon.com/lambda/latest/dg/invocation-sync.html), details about the function response, including errors, are included in the response body and headers. For either invocation type, you can find more information in the [execution log](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-functions.html) and [trace](https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html).

When an error occurs, your function may be invoked multiple times. Retry behavior varies by error type, client, event source, and invocation type. For example, if you invoke a function asynchronously and it returns an error, Lambda executes the function up to two more times. For more information, see [Error handling and automatic retries in Lambda](https://docs.aws.amazon.com/lambda/latest/dg/invocation-retries.html).

For [asynchronous invocation](https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html), Lambda adds events to a queue before sending them to your function. If your function does not have enough capacity to keep up with the queue, events may be lost. Occasionally, your function may receive the same event multiple times, even if no error occurs. To retain events that were not processed, configure your function with a [dead-letter queue](https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-dlq).

The status code in the API response doesn't reflect function errors. Error codes are reserved for errors that prevent your function from executing, such as permissions errors, [quota](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html) errors, or issues with your function's code and configuration. For example, Lambda returns `TooManyRequestsException` if running the function would cause you to exceed a concurrency limit at either the account level (`ConcurrentInvocationLimitExceeded`) or function level (`ReservedFunctionConcurrentInvocationLimitExceeded`).

For functions with a long timeout, your client might disconnect during synchronous invocation while it waits for a response. Configure your HTTP client, SDK, firewall, proxy, or operating system to allow for long connections with timeout or keep-alive settings.

This operation requires permission for the [lambda:InvokeFunction](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_awslambda.html) action. For details on how to set up permissions for cross-account invocations, see [Granting function access to other accounts](https://docs.aws.amazon.com/lambda/latest/dg/access-control-resource-based.html#permissions-resource-xaccountinvoke).

## Path parameters

- `FunctionName` string, required

## Query parameters

- `Qualifier` string

## Headers

- `X-Amz-Invocation-Type` 'Event' | 'RequestResponse' | 'DryRun'
- `X-Amz-Log-Type` 'None' | 'Tail'
- `X-Amz-Client-Context` string

## Request body

- object
  - `Payload` string, password — <p>The JSON that you want to provide to your Lambda function as input.</p> <p>You can enter the JSON directly. For example, <code>--payload '{ "key": "value" }'</code>. You can also specify a file path. For example, <code>--payload file://payload.json</code>.</p>

## Response `200`

Success

- InvocationResponse
  - `StatusCode` integer — The HTTP status code is in the 200 range for a successful request. For the <code>RequestResponse</code> invocation type, this status code is 200. For the <code>Event</code> invocation type, this status code is 202. For the <code>DryRun</code> invocation type, the status code is 204.
  - `Payload` string, password — The response from the function, or an error object.

## Other responses

- `480` — ServiceException
- `481` — ResourceNotFoundException
- `482` — InvalidRequestContentException
- `483` — RequestTooLargeException
- `484` — UnsupportedMediaTypeException
- `485` — TooManyRequestsException
- `486` — InvalidParameterValueException
- `487` — EC2UnexpectedException
- `488` — SubnetIPAddressLimitReachedException
- `489` — ENILimitReachedException
- `490` — EFSMountConnectivityException
- `491` — EFSMountFailureException
- `492` — EFSMountTimeoutException
- `493` — EFSIOException
- `494` — SnapStartException
- `495` — SnapStartTimeoutException
- `496` — SnapStartNotReadyException
- `497` — EC2ThrottledException
- `498` — EC2AccessDeniedException
- `499` — InvalidSubnetIDException
- `500` — InvalidSecurityGroupIDException
- `501` — InvalidZipFileException
- `502` — KMSDisabledException
- `503` — KMSInvalidStateException
- `504` — KMSAccessDeniedException
- `505` — KMSNotFoundException
- `506` — InvalidRuntimeException
- `507` — ResourceConflictException
- `508` — ResourceNotReadyException

---

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