Skip to main content

Create dependency

Create dependency. POST /api/openapi/v1/environment-packages, scope admin.v1.environment-packages.manage.

  • Scope: admin.v1.environment-packages.manage
  • Permission: Manage dependencies
  • Action: manage
  • Endpoint: POST/api/openapi/v1/environment-packages
Use Authorization: Bearer \<API_KEY\>. The application must have subject_scope={"mode":"all"}; restricted scopes return 403. Scopes are independently granted. Do not cache responses. Reuses the UI dependency service. First upload one file to uploads as multipart/form-data, then create or replace with JSON metadata and upload_id. Files must be nonempty and at most 1 GiB. Receipts are bound to the organization and uploader, expire in one hour and can be consumed once. Replacement requires expected_revision and retains dependency/platform/arch and enabled. The service calculates size and SHA-256; it does not inspect executable compatibility. Listing preserves UI filters and pagination. Writes and long-running uploads recheck current application authorization.

Common request headers

Apply the “Authentication and headers” section in “Configure the QwenWork console through APIs”: Authorization is required and X-Request-Id is optional. See this page for the required scope. Whether Idempotency-Key applies and is required is specified in this page’s request parameters; a tracing identifier does not replace an idempotency key.

Request parameters

Request body: required; Content-Type: application/json.
NameLocationTypeRequiredDescriptionExample
archbodystringYesarch; enum=["x64", "arm64"] Values: "arm64", "x64"-
dependencybodystringYesdependency; maxLength=64, pattern="^[a-z0-9][a-z0-9._-]{0,63}$"-
enabledbodybooleanNoenabled-
expected_revisionbodyinteger · int64NoRevision from the latest read; format="int64", minimum=1-
platformbodystringYesplatform; enum=["windows", "macos", "linux"] Values: "linux", "macos", "windows"-
upload_idbodystringYesupload id-
versionbodystringYesversion; maxLength=64-

Response statuses

HTTP statusTriggerResponse structureClient action
201Request succeededSee “Response” on this pageRead the response.
defaultOther authentication, authorization, validation or dependency errorsSee “General error” in “Configure the QwenWork console through APIs”Handle the status and code; verify the result and idempotency requirements before retrying writes.

Response

Content-Type: application/json
NameTypeRequiredDescriptionExample
archstringYesarch; enum=["x64", "arm64"] Values: "arm64", "x64"-
checksum_sha256stringYeschecksum sha256-
created_atstring · date-timeYescreated at; format="date-time"-
dependencystringYesdependency; maxLength=64, pattern="^[a-z0-9][a-z0-9._-]{0,63}$"-
enabledbooleanYesenabled-
file_namestringYesfile name-
idstringYesid-
platformstringYesplatform; enum=["windows", "macos", "linux"] Values: "linux", "macos", "windows"-
revisioninteger · int64YesCurrent revision for concurrency control; format="int64"-
size_bytesinteger · int64Yessize bytes; format="int64"-
updated_atstring · date-timeYesupdated at; format="date-time"-
versionstringYesversion-

Runtime limits and contract notes

The HTTP 422 / environment_package_invalid error root contains required strings field and reason identifying the rejected input. These are top-level fields for this business branch, not universal details members.

Errors and retries

Existing UI error codes and validation are preserved. 401/403 indicate authentication or authorization failure; 409 requires rereading before retry; 413 indicates an oversized request; 400/422 indicate invalid input; 503 indicates an unavailable dependency. The response and machine contract are authoritative. Retry idempotent creates with the same Idempotency-Key and payload.