All Products
Search
Document Center

API Gateway:CreateHttpApi

Last Updated:Jul 13, 2026

Creates an HTTP API.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

apig:CreateHttpApi

create

*HttpApi

acs:apig:{#regionId}:{#accountId}:httpapi/*

None None

Request syntax

POST /v1/http-apis HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The request body.

{'key': 'value'}

name

string

Yes

The API name.

test-api

description

string

No

The API description.

Test API for integration

protocols

array

No

The list of API access protocols.

string

No

The API access protocol.

Valid values:

  • HTTPS :

    HTTPS protocol.

  • HTTP :

    HTTP protocol.

HTTP

basePath

string

No

The API base path. The path must start with a forward slash (/), cannot exceed 256 bytes in length, and cannot contain spaces. This parameter is required when type is set to Rest. When type is set to LLM, Ai, or Agent, this parameter is optional and defaults to /.

/v1

versionConfig HttpApiVersionConfig

No

The API versioning configuration.

type

string

Yes

The type of the HTTP API. Valid values:

  • Http

  • Rest

  • WebSocket

  • HttpIngress

  • LLM

  • Agent

Valid values:

  • HttpIngress :

    HTTP Ingress API, accessed through Ingress.

  • Agent :

    Agent proxy API.

  • Rest :

    RESTful API

  • Http :

    Standard HTTP API.

  • LLM :

    Large language model API.

  • WebSocket :

    WebSocket API

Http

ingressConfig

object

No

The HTTP Ingress API configuration. This parameter is required and cannot be nil when type is set to HttpIngress. This parameter is not required for other types.

environmentId

string

No

The environment ID.

env-cq146allhtgk***

sourceId deprecated

string

No

The source ID.

src-crdddallhtgtr***

ingressClass

string

No

The Ingress Class to listen on.

mse

watchNamespace

string

No

The namespace to listen on.

default

overrideIngressIp

boolean

No

Specifies whether to update the address in the Ingress Status.

false

clusterId

string

No

The cluster ID.

k7v5eobfzttudni2pw***

resourceGroupId

string

No

The resource group ID.

rg-xxx

aiProtocols

array

No

The AI API protocols. This parameter is required when type is set to LLM, and only one protocol can be specified. This parameter is required when type is set to Ai, and multiple protocols can be specified. This parameter is not required for other types.

string

No

The AI API protocol.

OpenAI/v1

agentProtocols

array

No

The list of protocols supported by the agent. This parameter is required when type is set to Agent. This parameter is not required for other types.

string

No

The list of protocols supported by the agent. This parameter is required when type is set to Agent. This parameter is not required for other types.

http/https

deployConfigs

array

No

The API deployment configurations. This parameter is required when type is set to LLM or Ai, and only one deployment configuration can be specified. This parameter is not validated at the request level for other types.

HttpApiDeployConfig

No

The API deployment configuration.

enableAuth

boolean

No

Specifies whether to enable authentication. This parameter is validated when type is set to LLM, Ai, or Agent. This parameter is not validated at the request level when type is set to Rest.

true

authConfig AuthConfig

No

The authentication configuration. This parameter is required when enableAuth is set to true.

modelCategory

string

No

The model category. This parameter is optional when type is set to LLM or Ai. This parameter is not required for other types.

Valid values:

  • Others :

    Others.

  • Video :

    Video generation.

  • MultiModal :

    Multimodal.

  • Embedding :

    Embedding.

  • Text :

    Text generation.

  • Image :

    Image generation.

  • Audio :

    Audio processing.

  • Rerank :

    Reranking.

Text

removeBasePathOnForward

boolean

No

Specifies whether to remove the base path when forwarding requests.

true

firstByteTimeout

integer

No

The timeout period for waiting for the first byte from the backend.

30

belongGatewayId

string

No

The ID of the gateway to which the API belongs.

gw-abc123xyz789

dryRun deprecated

boolean

No

Specifies whether to perform a dry run without executing the operation.

true

strategy

string

No

The conflict merge strategy for import.

ExistFirst

Response elements

Element

Type

Description

Example

object

The response body.

requestId

string

The request ID.

A1994B10-C6A8-58FA-8347-6A08B0D4EFDE

code

string

The status code.

Ok

message

string

The response message.

success

data

object

The API information.

httpApiId

string

HTTP API ID。

api-xxx

name

string

The API name.

test-api

Examples

Success response

JSON format

{
  "requestId": "A1994B10-C6A8-58FA-8347-6A08B0D4EFDE",
  "code": "Ok",
  "message": "success",
  "data": {
    "httpApiId": "api-xxx",
    "name": "test-api"
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.