Skip to main content

Create Service

This API is used to create a website acceleration service.

Request

Request-Line

POST /cdn/v1.0/service HTTP/1.1

Request Parameters

Body Parameters

ParameterTypeRequiredDescription
domainNameStringMandatoryPrimary domain name for acceleration.
originsArrayMandatoryList of origin servers. At least one origin is required. For multiple origins, the order determines the priority (the first one is primary, subsequent ones are fallbacks). See Origin for details.
defaultHostHeaderStringMandatorySpecifies the default host header and SNI when no explicit host header or SNI is configured. preserve: Maintains the host header and SNI from the original request. originHost: Uses the host from the origin URL.
alternateDomainNamesArrayOptionalList of alternate domain names for the service.
streamingBooleanOptionalWhether to combine multiple client requests into a single request to the origin server. true: Enabled, false: Disabled. Default is false.
http2BooleanOptionalEnable HTTP/2 protocol. Default is true.
http3BooleanOptionalEnable HTTP/3 protocol. Default is false.
redirectHttpToHttpsBooleanOptionalWhether to redirect all HTTP requests to HTTPS. Default is false.
tlsProfileStringOptionalTLS security profile. modern: TLS 1.3 only, highest security, no backward compatibility. intermediate: Recommended for most services, compatible with modern clients. old: Maximum compatibility, use only for legacy client support.
enabledBooleanOptionalWhether the service is enabled. Default is true.

Object: Origin

Property nameTypeRequiredDescription
originUrlStringMandatoryOrigin server address. Format: [http[s]://]hostname[:port][/path/prefix]. If scheme is specified, it is forced for all origin requests. If omitted, the client's protocol is used.
sniStringOptionalServer Name Indication (SNI) value to send during TLS handshake with the origin.
headersObjectOptionalCustom headers to include when requesting from the origin.
s3CredentialObjectOptionalS3-compatible storage credentials. See S3Credential for details.

Object: S3Credential

Property nameTypeRequiredDescription
accessKeyStringMandatoryAWS access key ID for generating S3 signature.
accessSecretStringMandatoryAWS access secret for generating S3 signature.
regionStringMandatoryAWS region, e.g., ap-southeast-1.
dropQueryStringBooleanOptionalWhether to drop query strings before generating the S3 signature. Default is false.

Response

Response Body

Property nameTypeDescription
idIntegerService ID number.
domainNameStringPrimary domain name for acceleration.
originsArrayList of origin servers. At least one origin is required. For multiple origins, the order determines the priority (the first one is primary, subsequent ones are fallbacks). See Origin for details.
defaultHostHeaderStringSpecifies the default host header and SNI when no explicit host header or SNI is configured. preserve: Maintains the host header and SNI from the original request. originHost: Uses the host from the origin URL.
alternateDomainNamesArrayList of alternate domain names for the service.
streamingBooleanWhether to combine multiple client requests into a single request to the origin server. true: Enabled, false: Disabled. Default is false.
http2BooleanEnable HTTP/2 protocol. Default is true.
http3BooleanEnable HTTP/3 protocol. Default is false.
redirectHttpToHttpsBooleanWhether to redirect all HTTP requests to HTTPS. Default is false.
tlsProfileStringTLS security profile. modern: TLS 1.3 only, highest security, no backward compatibility. intermediate: Recommended for most services, compatible with modern clients. old: Maximum compatibility, use only for legacy client support.
enabledBooleanWhether the service is enabled. Default is true.

Status Codes, Error Codes and Error Messages

Status CodeError CodeError Message
400InvalidCustomer.IdEmptyCustomer ID cannot be empty.
400InvalidService.EmptyService cannot be empty.
400InvalidService.DomainNameEmptyDomain name cannot be empty.
400InvalidService.OriginsEmptyOrigins cannot be empty.
400InvalidService.OriginEmptyOrigin cannot be empty.
400InvalidService.OriginUrlEmptyOrigin URL cannot be empty.
400InvalidService.S3CredentialAccessKeyEmptyS3 access key cannot be empty.
400InvalidService.S3CredentialAccessSecretEmptyS3 access secret cannot be empty.
400InvalidService.S3CredentialRegionEmptyS3 region cannot be empty.
400InvalidService.DefaultHostHeaderEmptyDefault host header cannot be empty.
400InvalidService.DefaultHostHeaderInCorrectDefault host header value is invalid.
400InvalidService.TLSProfileInCorrectTLS profile value is invalid.
409InvalidService.DomainNameDomain name already exists.
500InvalidCustomer.ProvisionNotFoundCustomer provision record not found. Please contact support.

Examples

Create Service

Request

POST /cdn/v1.0/service  HTTP/1.1

{
"domainName": "test.example.com",
"origins": [
{
"originUrl": "https://origin1.example.com",
"sni": "origin-sni.example.com",
"headers": {
"X-Forwarded-For": "client-ip",
"X-Custom-Header": "test-value",
"Host": "origin-host.example.com"
},
"s3Credential": {
"accessKey": "AKIAEXAMPLE123456",
"accessSecret": "secret1234567890abcdefghijklmnopqrstuvwxyz",
"region": "us-east-1",
"dropQueryString": false
}
}
],
"defaultHostHeader": "originHost",
"alternateDomainNames": [
"cdn.example.com",
"www.test.example.com"
],
"streaming": true,
"http2": true,
"http3": false,
"redirectHttpToHttps": true,
"tlsProfile": "modern",
"enabled": true
}

Successful Response Body


{
"id": 228622,
"domainName": "test.example.com",
"streaming": true,
"http2": true,
"http3": false,
"redirectHttpToHttps": true,
"enabled": true,
"tlsProfile": "modern",
"origins": [
{
"originUrl": "https://origin1.example.com",
"sni": "origin-sni.example.com",
"headers": {
"X-Custom-Header": "test-value",
"X-Forwarded-For": "client-ip",
"Host": "origin-host.example.com"
},
"s3Credential": {
"accessKey": "AKIAEXAMPLE123456",
"accessSecret": "secret1234567890abcdefghijklmnopqrstuvwxyz",
"region": "us-east-1",
"dropQueryString": false
}
}
],
"defaultHostHeader": "originHost",
"alternateDomainNames": [
"cdn.example.com",
"www.test.example.com"
],
"cName": "edge2x.testing.veloceed.com"
}