tencent cloud


Last updated: 2023-07-18 11:11:03

1. API Description

Domain name for API request: scf.tencentcloudapi.com.

This API is used to run a function.

A maximum of 100 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: Invoke.
Version Yes String Common Params. The value used for this API: 2018-04-16.
Region Yes String Common Params. For more information, please see the list of regions supported by the product. This API only supports: ap-bangkok, ap-beijing, ap-chengdu, ap-chongqing, ap-guangzhou, ap-hongkong, ap-mumbai, ap-seoul, ap-shanghai, ap-shanghai-fsi, ap-shenzhen-fsi, ap-singapore, ap-tokyo, eu-frankfurt, na-ashburn, na-siliconvalley, na-toronto, sa-saopaulo.
FunctionName Yes String Function name
InvocationType No String Fill in RequestResponse for synchronized invocations (default and recommended) and Event for asychronized invocations. Note that for synchronized invocations, the max timeout period is 300s. Choose asychronized invocations if the required timeout period is longer than 300 seconds. You can also use InvokeFunction for synchronized invocations.
Qualifier No String The version or alias of the triggered function. It defaults to $LATEST
ClientContext No String Function running parameter, which is in the JSON format. The maximum parameter size is 6 MB for synchronized invocations and 128KB for asynchronized invocations. This field corresponds to event input parameter.
LogType No String Null for async invocations
Namespace No String Namespace
RoutingKey No String Traffic routing config in json format, e.g., {"k":"v"}. Please note that both "k" and "v" must be strings. Up to 1024 bytes allowed.

3. Output Parameters

Parameter Name Type Description
Result Result Function execution result
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Running function

Input Example

&<Common request parameters>

Output Example

    "Response": {
        "Result": {
            "MemUsage": 3207168,
            "Log": "",
            "RetMsg": "hello from scf",
            "BillDuration": 100,
            "FunctionRequestId": "6add56fa-58f1-11e8-89a9-5254005d5fdb",
            "Duration": 0.826,
            "ErrMsg": "",
            "InvokeResult": 0
        "RequestId": "c2af8a64-c922-4d55-aee0-bd86a5c2cd12"

5. Developer Resources


TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation.FunctionStatusError Operation failed. The function is deploying.
FailedOperation.InvokeFunction Failed to invoke the function.
InternalError Internal error.
InternalError.System Internal system error.
InvalidParameter.FunctionName The value of FunctionName does not conform to the specification. Please fix it and try again. For more information, please visit https://tencentcs.com/5jXKFnBW.
InvalidParameterValue Incorrect parameter value.
InvalidParameterValue.Param The input parameter is not in the standard JSON format.
ResourceNotFound.Function The function does not exist.
ResourceNotFound.FunctionName The function does not exist.
ResourceUnavailable.InsufficientBalance Your balance is insufficient. Please top up first.
UnauthorizedOperation.CAM CAM authentication failed.
Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support