> 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/python/container-registry/api/tokensapi.md).

# TokensApi

## TokensApi

All URIs are relative to *<https://api.ionos.com/containerregistries>*

| Method                                                                | HTTP request                                         | Description                                |
| --------------------------------------------------------------------- | ---------------------------------------------------- | ------------------------------------------ |
| [**registries\_tokens\_delete**](#registries_tokens_delete)           | **DELETE** /registries/{registryId}/tokens/{tokenId} | Delete token                               |
| [**registries\_tokens\_find\_by\_id**](#registries_tokens_find_by_id) | **GET** /registries/{registryId}/tokens/{tokenId}    | Get token information                      |
| [**registries\_tokens\_get**](#registries_tokens_get)                 | **GET** /registries/{registryId}/tokens              | List all tokens for the container registry |
| [**registries\_tokens\_patch**](#registries_tokens_patch)             | **PATCH** /registries/{registryId}/tokens/{tokenId}  | Update token                               |
| [**registries\_tokens\_post**](#registries_tokens_post)               | **POST** /registries/{registryId}/tokens             | Create token                               |
| [**registries\_tokens\_put**](#registries_tokens_put)                 | **PUT** /registries/{registryId}/tokens/{tokenId}    | Create or replace token                    |

## **registries\_tokens\_delete**

> registries\_tokens\_delete(registry\_id, token\_id)

Delete token

#### Example

```python
from __future__ import print_function
import time
import ionoscloud_container_registry
from ionoscloud_container_registry.rest import ApiException

# Defining the host is optional and defaults to https://api.ionos.com/containerregistries
configuration = ionoscloud_container_registry.Configuration(
    host = 'https://api.ionos.com/containerregistries',
)

# Example of configuring HTTP Basic Authorization
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

with ionoscloud_container_registry.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ionoscloud_container_registry.TokensApi(api_client)
    registry_id = 'registry_id_example' # str | The unique ID of the registry
    token_id = 'token_id_example' # str | The unique ID of the token
    try:
        # Delete token
        api_instance.registries_tokens_delete(registry_id, token_id)
    except ApiException as e:
        print('Exception when calling TokensApi.registries_tokens_delete: %s\n' % e)
```

#### Parameters

| Name             | Type    | Description                   | Notes |
| ---------------- | ------- | ----------------------------- | ----- |
| **registry\_id** | **str** | The unique ID of the registry |       |
| **token\_id**    | **str** | The unique ID of the token    |       |

#### Return type

void (empty response body)

#### Authorization

basicAuth, tokenAuth

#### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## **registries\_tokens\_find\_by\_id**

> TokenResponse registries\_tokens\_find\_by\_id(registry\_id, token\_id)

Get token information

Gets all information for a specific token used to access a container registry

#### Example

```python
from __future__ import print_function
import time
import ionoscloud_container_registry
from ionoscloud_container_registry.rest import ApiException

# Defining the host is optional and defaults to https://api.ionos.com/containerregistries
configuration = ionoscloud_container_registry.Configuration(
    host = 'https://api.ionos.com/containerregistries',
)

# Example of configuring HTTP Basic Authorization
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

with ionoscloud_container_registry.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ionoscloud_container_registry.TokensApi(api_client)
    registry_id = 'registry_id_example' # str | The unique ID of the registry
    token_id = 'token_id_example' # str | The unique ID of the token
    try:
        # Get token information
        api_response = api_instance.registries_tokens_find_by_id(registry_id, token_id)
        print(api_response)
    except ApiException as e:
        print('Exception when calling TokensApi.registries_tokens_find_by_id: %s\n' % e)
```

#### Parameters

| Name             | Type    | Description                   | Notes |
| ---------------- | ------- | ----------------------------- | ----- |
| **registry\_id** | **str** | The unique ID of the registry |       |
| **token\_id**    | **str** | The unique ID of the token    |       |

#### Return type

[**TokenResponse**](/cloud/python/container-registry/models/tokenresponse.md)

#### Authorization

basicAuth, tokenAuth

#### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## **registries\_tokens\_get**

> TokensResponse registries\_tokens\_get(registry\_id, offset=offset, limit=limit)

List all tokens for the container registry

#### Example

```python
from __future__ import print_function
import time
import ionoscloud_container_registry
from ionoscloud_container_registry.rest import ApiException

# Defining the host is optional and defaults to https://api.ionos.com/containerregistries
configuration = ionoscloud_container_registry.Configuration(
    host = 'https://api.ionos.com/containerregistries',
)

# Example of configuring HTTP Basic Authorization
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

with ionoscloud_container_registry.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ionoscloud_container_registry.TokensApi(api_client)
    registry_id = 'registry_id_example' # str | The unique ID of the registry
    try:
        # List all tokens for the container registry
        api_response = api_instance.registries_tokens_get(registry_id)
        print(api_response)
    except ApiException as e:
        print('Exception when calling TokensApi.registries_tokens_get: %s\n' % e)
```

#### Parameters

| Name             | Type    | Description                                                                                                                     | Notes                           |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
| **registry\_id** | **str** | The unique ID of the registry                                                                                                   |                                 |
| **offset**       | **str** | The first element (from the complete list of the elements) to include in the response (used together with limit for pagination) | \[optional] \[default to '0']   |
| **limit**        | **str** | The maximum number of elements to return (used together with offset for pagination)                                             | \[optional] \[default to '100'] |

#### Return type

[**TokensResponse**](/cloud/python/container-registry/models/tokensresponse.md)

#### Authorization

basicAuth, tokenAuth

#### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## **registries\_tokens\_patch**

> TokenResponse registries\_tokens\_patch(registry\_id, token\_id, patch\_token\_input)

Update token

Update token properties, for example: - change status to 'enabled' or 'disabled' - change expiry date

#### Example

```python
from __future__ import print_function
import time
import ionoscloud_container_registry
from ionoscloud_container_registry.rest import ApiException

# Defining the host is optional and defaults to https://api.ionos.com/containerregistries
configuration = ionoscloud_container_registry.Configuration(
    host = 'https://api.ionos.com/containerregistries',
)

# Example of configuring HTTP Basic Authorization
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

with ionoscloud_container_registry.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ionoscloud_container_registry.TokensApi(api_client)
    registry_id = 'registry_id_example' # str | The unique ID of the registry
    token_id = 'token_id_example' # str | The unique ID of the token
    patch_token_input = ionoscloud_container_registry.PatchTokenInput() # PatchTokenInput | 
    try:
        # Update token
        api_response = api_instance.registries_tokens_patch(registry_id, token_id, patch_token_input)
        print(api_response)
    except ApiException as e:
        print('Exception when calling TokensApi.registries_tokens_patch: %s\n' % e)
```

#### Parameters

| Name                    | Type                                                                              | Description                   | Notes |
| ----------------------- | --------------------------------------------------------------------------------- | ----------------------------- | ----- |
| **registry\_id**        | **str**                                                                           | The unique ID of the registry |       |
| **token\_id**           | **str**                                                                           | The unique ID of the token    |       |
| **patch\_token\_input** | [**PatchTokenInput**](/cloud/python/container-registry/models/patchtokeninput.md) |                               |       |

#### Return type

[**TokenResponse**](/cloud/python/container-registry/models/tokenresponse.md)

#### Authorization

basicAuth, tokenAuth

#### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json

## **registries\_tokens\_post**

> PostTokenOutput registries\_tokens\_post(registry\_id, post\_token\_input)

Create token

Create a token - password is only available once in the POST response

#### Example

```python
from __future__ import print_function
import time
import ionoscloud_container_registry
from ionoscloud_container_registry.rest import ApiException

# Defining the host is optional and defaults to https://api.ionos.com/containerregistries
configuration = ionoscloud_container_registry.Configuration(
    host = 'https://api.ionos.com/containerregistries',
)

# Example of configuring HTTP Basic Authorization
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

with ionoscloud_container_registry.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ionoscloud_container_registry.TokensApi(api_client)
    registry_id = 'registry_id_example' # str | The unique ID of the registry
    post_token_input = ionoscloud_container_registry.PostTokenInput() # PostTokenInput | 
    try:
        # Create token
        api_response = api_instance.registries_tokens_post(registry_id, post_token_input)
        print(api_response)
    except ApiException as e:
        print('Exception when calling TokensApi.registries_tokens_post: %s\n' % e)
```

#### Parameters

| Name                   | Type                                                                            | Description                   | Notes |
| ---------------------- | ------------------------------------------------------------------------------- | ----------------------------- | ----- |
| **registry\_id**       | **str**                                                                         | The unique ID of the registry |       |
| **post\_token\_input** | [**PostTokenInput**](/cloud/python/container-registry/models/posttokeninput.md) |                               |       |

#### Return type

[**PostTokenOutput**](/cloud/python/container-registry/models/posttokenoutput.md)

#### Authorization

basicAuth, tokenAuth

#### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json

## **registries\_tokens\_put**

> PutTokenOutput registries\_tokens\_put(registry\_id, token\_id, put\_token\_input)

Create or replace token

Create/replace a token - password is only available once in the create response - "name" cannot be changed

#### Example

```python
from __future__ import print_function
import time
import ionoscloud_container_registry
from ionoscloud_container_registry.rest import ApiException

# Defining the host is optional and defaults to https://api.ionos.com/containerregistries
configuration = ionoscloud_container_registry.Configuration(
    host = 'https://api.ionos.com/containerregistries',
)

# Example of configuring HTTP Basic Authorization
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

with ionoscloud_container_registry.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ionoscloud_container_registry.TokensApi(api_client)
    registry_id = 'registry_id_example' # str | The unique ID of the registry
    token_id = 'token_id_example' # str | The unique ID of the token
    put_token_input = ionoscloud_container_registry.PutTokenInput() # PutTokenInput | 
    try:
        # Create or replace token
        api_response = api_instance.registries_tokens_put(registry_id, token_id, put_token_input)
        print(api_response)
    except ApiException as e:
        print('Exception when calling TokensApi.registries_tokens_put: %s\n' % e)
```

#### Parameters

| Name                  | Type                                                                          | Description                   | Notes |
| --------------------- | ----------------------------------------------------------------------------- | ----------------------------- | ----- |
| **registry\_id**      | **str**                                                                       | The unique ID of the registry |       |
| **token\_id**         | **str**                                                                       | The unique ID of the token    |       |
| **put\_token\_input** | [**PutTokenInput**](/cloud/python/container-registry/models/puttokeninput.md) |                               |       |

#### Return type

[**PutTokenOutput**](/cloud/python/container-registry/models/puttokenoutput.md)

#### Authorization

basicAuth, tokenAuth

#### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json


---

# 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/python/container-registry/api/tokensapi.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.
