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

# Origin groups

> Configure primary and backup HTTP or object-storage origins for Cloud CDN.

An origin group is a reusable set of one or more content sources. A distribution retrieves cache misses from its origin group.

## Origin fields

| Field | Description |
| - | - |
| `source` | Hostname or IP, with an optional port; do not include a URL scheme |
| `enabled` | Whether the origin can receive traffic |
| `backup_only` | Uses the origin only after eligible primary origins fail |
| `host_header_override` | Sends a specific Host header to this origin |

Use a Host header override when the origin is a shared virtual host, load balancer, or object-storage endpoint that routes by hostname.

## Upstream failover

Enable **Use next upstream** and choose which results permit another origin:

* Connection error or timeout.
* Invalid upstream header.
* HTTP 403, 404, 429, 500, 502, 503, or 504.

<Warning>
  Retrying non-idempotent requests can repeat an origin-side action. Limit allowed HTTP methods and failover conditions when the distribution accepts writes.
</Warning>

## Object storage

Object-storage origins can include a storage endpoint, bucket name, region, and AWS Signature Version 4 credentials. Some S3-compatible providers do not require a region. Credentials are write-only secrets; omit them on an update unless you intend to replace them.

## API example

```bash theme={null}
curl --request POST \
  --url https://api.aptranet.com/cloud-cdn/origin_groups \
  --header "Authorization: Bearer $APTRANET_ACCESS_KEY" \
  --header "Aptranet-Secret: $APTRANET_SECRET" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "production-origins",
    "use_next_upstream": true,
    "next_upstream_cases": {
      "on_error": true,
      "on_timeout": true,
      "on_invalid_header": true,
      "on_http_403": false,
      "on_http_404": false,
      "on_http_429": true,
      "on_http_500": true,
      "on_http_502": true,
      "on_http_503": true,
      "on_http_504": true
    },
    "origins": [
      {"source": "origin-a.example.com", "enabled": true, "backup_only": false},
      {"source": "origin-b.example.com", "enabled": true, "backup_only": true}
    ]
  }'
```

An origin group cannot be deleted while a distribution still depends on it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.