tencent cloud

Serverless Cloud Function

Release Notes and Announcements
Release Notes
Announcements
User Guide
Product Introduction
Overview
Related Concepts
How It Works
Strengths
Scenarios
Related Products
Purchase Guide
Billing Overview
Billing Mode
Billable Items and Billing Modes
Function Computing Power Support
Free Tier
SCF Pricing
Billing Example
Payment Overdue
Getting Started
Creating Event Function in Console
User Guide
Quota Management
Managing Functions
Web Function Management
Log Management
Concurrence Management
Trigger Management
Function URL
A Custom Domain Name
Version Management
Alias Management
Permission Management
Running Instance Management
Plugin Management
Managing Monitors and Alarms
Network Configuration
Layer Management
Execution Configuration
Extended Storage Management
DNS Caching Configuration
Resource Managed Mode Management
Near-Offline Resource Hosting Model
Workflow
Triggers
Trigger Overview
Trigger Event Message Structure Summary
API Gateway Trigger
COS Trigger
CLS Trigger
Timer Trigger
CKafka Trigger
Apache Kafka Trigger
MQTT Trigger
Trigger Configuration Description
MPS Trigger
CLB Trigger Description
TencentCloud API Trigger
Development Guide
Basic Concepts
Testing a Function
Environment Variables
Dependency Installation
Using Container Image
Error Types and Retry Policies
Dead Letter Queue
Connecting SCF to Database
Automated Deployment
Cloud Function Status Code
Common Errors and Solutions
Developer Tools
Serverless Web IDE
Calling SDK Across Functions
Third-Party Tools
Code Development
Python
Node.js
Golang
PHP
Java
Custom Runtime
Deploying Image as Function
Web Framework Development
Deploying Framework on Command Line
Quickly Deploying Egg Framework
Quickly Deploying Express Framework
Quickly Deploying Flask Framework
Quickly Deploying Koa Framework
Quickly Deploying Laravel Framework
Quickly Deploying Nest.js Framework
Quickly Deploying Next.js Framework
Quickly Deploying Nuxt.js Framework
Quickly Deploying Django Framework
Use Cases
Overview
Solutions with Tencent Cloud Services
Business Development
TRTC Practices
COS Practices
CKafka Practice
CLS
CLB Practice
MPS
CDN
CDWPG
VOD
SMS
ES
Scheduled Task
Video Processing
Success Stories
Tencent Online Education
Online Video Industry
Tencent Online Education
Best Practice of Tencent IEG Going Global
API Documentation
History
Introduction
API Category
Making API Requests
Other APIs
Namespace APIs
Layer Management APIs
Async Event Management APIs
Trigger APIs
Function APIs
Function and Layer Status Description
Data Types
Error Codes
SDK Documentation
FAQs
General
Web Function
Billing FAQs
Network FAQs
Log FAQs
SCF utility class
Event Handling FAQs
API Gateway Trigger FAQs
Related Agreement
Service Level Agreement
Contact Us
Glossary

Function URL Overview

PDF
Focus Mode
Font Size
Last updated: 2025-06-17 16:40:37

Overview

A function URL is a dedicated HTTP(S) endpoint for a function. After configuring a function URL for a function, you can invoke the function through its HTTP(S) endpoint using a Web browser, curl, Postman, or any HTTP client.
You can create and configure a function URL through the SCF console or SCF API/CLI. Once a function URL is created, its URL endpoint will remain unchanged permanently. The endpoint format of the function URL is as follows:
public network: https://<app-id>-<url-id>.<region>.tencentscf.com
private network: https://<app-id>-<url-id>.in.<region>.tencentscf.com
Function URL and trigger exist at the same level, suitable for event functions and Web functions. You can enable function URL and concurrently configure triggers such as API Gateway.
Function URL is one-to-one bound to the version and alias of a function. You need to manually turn on or off the function URL for each version and alias. By default, the function URL is off.
Notes:
If need to generate a WSS address,please enable a WebSocket support in the function configuration.

Calling Parameter

Event Function

Request parameters.

When the URL receives a request, the function will be triggered to run. At the same time, the URL will send the relevant information of the request to the triggered function in the form of an event input parameter. The relevant information of the request contains, for example, the specific service and API rule that received the request, the actual path of the request, the method, the request path, headers, query, etc.
// Example of Event detailed information [compatible with apigw protocol, remove relevant fields such as headerParameters, isBase64Encoded, pathParameters, queryStringParameters, requestContext]
{
"body":"{\\"test\\":\\"hello world\\"}",
"headers":{
"accept":"*/*",
"accept-encoding":"gzip, deflate, br",
"cache-control":"no-cache",
"connection":"keep-alive",
"content-length":"17",
"x-scf-remote-addr":"111.206.96.145" // this field is the client request IP
},
"httpMethod":"POST",
"path":"/",
"queryString":{
"a":"1",
"b":"2"
}
}

Response Parameters

When the function returns a response, the function parses the response and converts it to an HTTP response. Standard response payload:
{
"statusCode": 201,
"headers": {
"Content-Type": "application/json",
"My-Custom-Header": "Custom Value"
},
"body": "{ \\"message\\": \\"Hello, world!\\" }"
}
The function will infer the response format for you. If your function returns valid JSON and does not return a statusCode, the function assumes the statusCode is 200, the content-type is application/json, and the body is the function response.
The standard response parameter format of the function response is as follows:
Function output
HTTP response (the content seen by the client)
"Hello, world!"
HTTP/2 200
date: Wed, 08 Sep 2021 18:02:24 GMT
content-type: application/json
content-length: 15

"Hello, world!"
{
"message": "Hello, world!"
}
HTTP/2 200
date: Wed, 08 Sep 2021 18:02:24 GMT
content-type: application/json
content-length: 34

{
"message": "Hello, world!"
}
{
"statusCode": 201,
"headers": {
"Content-Type": "application/json",
"My-Custom-Header": "Custom Value"
},
"body": JSON.stringify({
"message": "Hello, world!"
})
}
HTTP/2 201
date: Wed, 08 Sep 2021 18:02:24 GMT
content-type: application/json
content-length: 27
my-custom-header: Custom Value

{
"message": "Hello, world!"
}

Web Function

When the URL receives an HTTP request, the function will be triggered to execute. At this time, the URL will directly forward the HTTP request without performing event type format conversion. Meanwhile, the request response is also directly forwarded.


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback