CreateCodeBundle

Updated at:
Copy as MD

Creates a function code package in pending status and returns a pre-signed OSS PUT upload credential.

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

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

POST /v1/projects/{projectId}/codeBundles HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

projectId

integer

Yes

The project ID.

123

Request parameters

Parameter

Type

Required

Description

Example

filename

string

Yes

The file name.

test-cases.zip

ciMetadata

string

No

An optional CI/CD metadata JSON string.

{"region":"cn-beijing"}

Response elements

Element

Type

Description

Example

object

Schema of Response

requestId

string

The request ID.

9A1F403F-0A85-5578-8B7C-55E3E9408659

codeBundleId

integer

The function code package ID.

111

projectId

integer

The project ID.

123

bundleVersion

string

The version identifier of the function code package.

1

status

string

The status of the function code package.

pending

filename

string

The file name.

test-cases.zip

createdAt

string

The time when the function code package was created.

2026-08-27T00:53:46.774Z

updatedAt

string

The time when the function code package was last updated.

2026-08-27T00:53:46.774Z

upload

object

The upload credential. See the following fields for details.

method

string

The HTTP method of the pre-signed URL. Valid values: PUT.

PUT

putUrl

string

The pre-signed OSS PUT upload URL.

https://codesec-beijing.oss-cn-beijing.aliyuncs.com/87766767%2F1001667%2F1004171.zip

requiredContentType

string

The Content-Type header that the client must include when performing the PUT request. This field is returned when putUrl is present.

application/octet-stream

expiresAt

string

The expiration time of the credential in RFC 3339 format.

2026-09-03T05:58:47.88987539Z

Examples

Success response

JSON format

{
  "requestId": "9A1F403F-0A85-5578-8B7C-55E3E9408659",
  "codeBundleId": 111,
  "projectId": 123,
  "bundleVersion": "1",
  "status": "pending",
  "filename": "test-cases.zip",
  "createdAt": "2026-08-27T00:53:46.774Z",
  "updatedAt": "2026-08-27T00:53:46.774Z",
  "upload": {
    "method": "PUT",
    "putUrl": "https://codesec-beijing.oss-cn-beijing.aliyuncs.com/87766767%2F1001667%2F1004171.zip",
    "requiredContentType": "application/octet-stream",
    "expiresAt": "2026-09-03T05:58:47.88987539Z"
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter.%s Invalid parameter:%s. Invalid parameter:%s.
400 NotFound.%s The resource does not exist. The resource does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.