Help Center/ FunctionGraph/ API Reference/ APIs/ Function Invocation/ Executing a Function Asynchronously and Returning Reserved Instance IDs
Updated on 2026-10-27 GMT+08:00

Executing a Function Asynchronously and Returning Reserved Instance IDs

Function

This API is used to execute a function asynchronously and return reserved instance IDs. It is suitable for clients that execute a time-consuming task but do not need to wait for the execution result. A reserved instance ID will be returned for this API. If the instance is abnormal, you can delete it based on its ID. Note that this API is only available for whitelisted users.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

URI

POST /v2/{project_id}/fgs/functions/{function_urn}/reserved-invocations

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Parameter description:

Project ID. For details, see Obtaining a Project ID.

Constraints

N/A

Value range:

32 characters, including letters and digits.

Default value:

N/A

function_urn

Yes

String

Parameter description:

URN of the function. For details, see Function Model.

Constraints

N/A

Value range:

Only letters, digits, underscores (_), hyphens (-), and colons (:) are allowed.

Default value:

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Parameter description:

User token.

The token can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token.

Constraints

N/A

Value range:

N/A

Default value:

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

{User defined key}

Yes

Object

Function execution request body, in JSON format.

Response Parameters

Status code: 202

Table 4 Response header parameters

Parameter

Type

Description

Content-Type

String

application/json

Table 5 Response body parameters

Parameter

Type

Description

instance_id

String

Reserved instance ID.

Status code: 404

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

Execute a function asynchronously and return reserved instance IDs.

POST /v2/{project_id}/fgs/functions/{function_urn}/reserved-invocations

{
  "body" : "",
  "requestContext" : {
    "apiId" : "bc1dcffd-xx",
    "requestId" : "xxx",
    "stage" : "RELEASE"
  },
  "queryStringParameters" : {
    "responseType" : "html"
  },
  "httpMethod" : "GET",
  "pathParameters" : null,
  "headers" : {
    "accept-language" : "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
    "accept-encoding" : "gzip, deflate, br",
    "x-forwarded-port" : "443",
    "x-forwarded-for" : "127.0.0.1",
    "x-forwarded-proto" : "https"
  },
  "path" : "/apig-event-template",
  "isBase64Encoded" : true
}

Example Responses

Status code: 202

{
  "instance_id" : "048bad9b-96ae-45ad-8f12-4061a744ef9d"
}

Status code: 404

{
  "error_code" : "FSS.1051",
  "error_msg" : "Not found the function"
}

Status Codes

Status Code

Description

202

Accepted

404

Not Found

Error Codes

See Error Codes.