> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/containers/private-container-registry/api-howtos/create_registry.md).

# Create Container Registry

Once you have fetched your required information, you can now create a new registry. For the registry, you can alter the days and time. You can also update the location based on the available container registry locations.

We assume the following prerequisites:

* [<mark style="color:blue;">A location for container registry</mark>](/cloud/containers/private-container-registry/api-howtos/locations.md)
* [<mark style="color:blue;">An available name for the registry</mark>](/cloud/containers/private-container-registry/api-howtos/registries.md)

With the `POST` request, you can create a container registry.

## Request

```bash
curl --location  \
--request POST 'https://api.ionos.com/containerregistries/registries' \
--header 'Authorization: Bearer ${TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "properties": {
    "garbageCollectionSchedule": {
      "days": [
        "Saturday",
        "Sunday"
      ],
      "time": "19:30:00+00:00"
    },
    "location": "de/fra",
    "name": "demo",
    "apiSubnetAllowList": ["198.51.100.0/24", "203.0.113.1/32"]
  }
}'
```

### Input Parameters

You can update the limit value to get specific registries based on the limit value being passed.

| Field                  |  Type  |                                                               Description                                                               | Example           |
| ---------------------- | :----: | :-------------------------------------------------------------------------------------------------------------------------------------: | ----------------- |
| **days**               |  array |                                                      The days of the week selected.                                                     | `Monday`          |
| **time**               | string |                                                The timestamp of creation of the registry                                                | `19:30:00+00:00`  |
| **location**           | string |                                                      The location of the resource.                                                      | `de/fra`          |
| **name**               | string |                                      The name of the registry. It must be unique within the folder.                                     | `Demo`            |
| **days**               |  array |                                                      The days of the week selected.                                                     | `Monday`          |
| **apiSubnetAllowList** |  array | The list of IP subnets that can access the registry. If this parameter is omitted, the registry will be accessible from any IP address. | `198.51.100.0/24` |

## Response

**200 OK - Successfully showed the list of registries**

```json
{
   "id": "709y8e3c-d5c8-4359-8f85-c200fb89e87c",
   "type": "registry",
   "href": "",
   "metadata": {
       "createdBy": "sample@ionos.com",
       "createdByUserId": "a7af0375-1c1d-4387-9ef1-6eu95d30e74a",
       "createdDate": "2022-10-07T14:30:06Z",
       "state": "New"
   },
   "properties": {
       "name": "demo",
       "location": "de/fra",
       "garbageCollectionSchedule": {
           "days": [
               "Sunday",
               "Saturday"
           ],
           "time": "19:30:00+00:00"
       },
       "storageUsage": {
           "bytes": 0
       },
       "hostname": "",
       "apiSubnetAllowList": ["198.51.100.0/24", "203.0.113.1/32"]
   }
}
```

### Response Fields

| Field                  |  Type  |                                                                                    Description                                                                                   | Example                 |
| ---------------------- | :----: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | ----------------------- |
| **id**                 | string |                                                                             The ID of fetched output.                                                                            | `locations`             |
| **type**               | string |                                                                               The type of resource.                                                                              | `registry`              |
| **createdBy**          | string |                                                          ID of the user or service account that initiated the operation.                                                         | `sample@ionos.com`      |
| **createdDate**        | string |                                                                    The date when the operation was initiated.                                                                    | `h2022-10-07T14:30:06Z` |
| **days**               |  array |                                                                          The days of the week selected.                                                                          | `Sunday, Saturday`      |
| **apiSubnetAllowList** |  array | The list of IP subnets, in CIDR notation, that can access the registry. For single IPs a `/32` mask can be used. Addresses without a mask will be assumed to carry a `/32` mask. | `198.51.100.0/24`       |

{% hint style="info" %}
**Note:**

* Your values will differ from those in the sample code. The container registry will be created as shown in the **201 response**. Your response will have a different `id`, `createdBy` and `createdDate`.
* Here, we do not get a **hostname** in the output because the host has not be allocated yet.
  {% endhint %}

**400 Bad Request - The request made is invalid or corrupted**

```json
{
 "httpStatus": 400,
 "messages": [
   {
     "errorCode": "123",
     "message": "ad velit dolor dolore laboris"
   },
   {
     "errorCode": "123",
     "message": "tempo
   }
 ]
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ionos.com/cloud/containers/private-container-registry/api-howtos/create_registry.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
