> ## Documentation Index
> Fetch the complete documentation index at: https://docs.akua.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Create package

Creates a private Package in the Akua-Context Workspace, hosted at Akua or imported from an external OCI repository. It holds no versions yet; publish each with Create package version. Retry with the same Idempotency-Key to receive the same Package.

`POST https://api.akua.dev/v1/packages`

## Authorizations

- `Authorization: Bearer <token>` (BearerAuth): Bearer token for the authenticated caller.

## Headers

- `akua-context` (string): Optional workspace/scope context for the request. Carries a single workspace wire id (`ws_…`) today. Only needed for broad tokens - a workspace-owned token implies its workspace. Required string length: `1 - 53`. Example: `"ws_j572abc123def4"`.
- `idempotency-key` (string): Optional caller-supplied idempotency key. Any non-empty key up to 64 characters is accepted. Endpoint-specific documentation describes how the key is used. Required string length: `1 - 64`. Example: `"create-prod-2026-05-07"`.

## Body

Required.

`application/json`: `CreatePackageRequest`

- `name` (string, required): Required string length: `1 - 100`.
- `source` (object, required)
  - Any of:
    - `hosted`
      - `kind` (enum<string>, required): Available options: `"hosted"`.
      - `chart` (string, required): Required string length: `1 - 253`. Pattern: `^[a-z0-9]+(?:[._-][a-z0-9]+)*$`.
    - `oci`
      - `kind` (enum<string>, required): Available options: `"oci"`.
      - `repository` (string, required): Public OCI repository that holds the chart, without the chart name. Akua pulls each version anonymously. Required string length: `7 - 2048`. Pattern: `^oci:\/\/[^\s]+$`. Example: `"oci://ghcr.io/acme/charts"`.
      - `chart` (string, required): Required string length: `1 - 253`. Example: `"web"`.

## Response

### 201: Package created

`application/json`: `PackageResource`

- `id` (string, required): Required string length: `3 - 54`.
- `html_url` (string<uri>, required): Absolute dashboard URL for this resource. OUTPUT_ONLY. Maximum string length: `2048`.
- `workspace_id` (string, required): Required string length: `2 - 53`.
- `name` (string, required)
- `source` (object, required)
  - Any of:
    - `hosted`
      - `kind` (enum<string>, required): Available options: `"hosted"`.
      - `chart` (string, required): Required string length: `1 - 253`. Pattern: `^[a-z0-9]+(?:[._-][a-z0-9]+)*$`.
    - `oci`
      - `kind` (enum<string>, required): Available options: `"oci"`.
      - `repository` (string, required): Public OCI repository that holds the chart, without the chart name. Akua pulls each version anonymously. Required string length: `7 - 2048`. Pattern: `^oci:\/\/[^\s]+$`. Example: `"oci://ghcr.io/acme/charts"`.
      - `chart` (string, required): Required string length: `1 - 253`. Example: `"web"`.
- `versions` (object[], required): Every version created for the Package, newest first.
  - `version` (string, required): Required string length: `1 - 128`. Pattern: `^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$`.
  - `status` (enum<string>, required): Available options: `"publishing"`, `"published"`, `"failed"`.
- `etag` (string, required)

### 400: The request is malformed.

`application/json`: `ApiBadRequest`

- `_tag` (enum<string>, required): Available options: `"Validation"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 401: Missing, invalid or expired credential.

`application/json`: `ApiUnauthorized`

- `_tag` (enum<string>, required): Available options: `"Unauthorized"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 403: The credential may not act in this workspace.

`application/json`: `ApiForbidden`

- `_tag` (enum<string>, required): Available options: `"Forbidden"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 409: The request conflicts with existing resource state or immutable intent.

`application/json`: `ApiConflict`

- `_tag` (enum<string>, required): Available options: `"Conflict"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 422: The request is well-formed but cannot be processed.

`application/json`: `ApiUnprocessable`

- `_tag` (enum<string>, required): Available options: `"Unprocessable"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 503: The service is temporarily unavailable.

`application/json`: `ApiServiceUnavailable`

- `_tag` (enum<string>, required): Available options: `"ServiceUnavailable"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

## Example request

```bash
curl --request POST \
  --url 'https://api.akua.dev/v1/packages' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "<string>",
    "source": {
      "kind": "hosted",
      "chart": "<string>"
    }
  }'
```

## Example response

`201` `application/json`

```json
{
  "id": "pkg_j572abc123def456",
  "html_url": "https://example.com",
  "workspace_id": "ws_j572abc123def456",
  "name": "<string>",
  "source": {
    "kind": "hosted",
    "chart": "<string>"
  },
  "versions": [
    {
      "version": "<string>",
      "status": "publishing"
    }
  ],
  "etag": "<string>"
}
```
