# 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

### Examples

```ruby
require 'time'
require 'ionoscloud-container-registry'
# setup authorization
IonoscloudContainerRegistry.configure do |config|
  # Configure HTTP basic authorization: basicAuth
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'

  # Configure API key authorization: tokenAuth
  config.api_key['Authorization'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['Authorization'] = 'Bearer'
end

api_instance = IonoscloudContainerRegistry::TokensApi.new
registry_id = TODO # String | The unique ID of the registry
token_id = TODO # String | The unique ID of the token

begin
  # Delete token
  api_instance.registries_tokens_delete(registry_id, token_id)
rescue IonoscloudContainerRegistry::ApiError => e
  puts "Error when calling TokensApi->registries_tokens_delete: #{e}"
end
```

#### Using the registries\_tokens\_delete\_with\_http\_info variant

This returns an Array which contains the response data (`nil` in this case), status code and headers.

> \<Array(nil, Integer, Hash)> registries\_tokens\_delete\_with\_http\_info(registry\_id, token\_id)

```ruby
begin
  # Delete token
  data, status_code, headers = api_instance.registries_tokens_delete_with_http_info(registry_id, token_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue IonoscloudContainerRegistry::ApiError => e
  puts "Error when calling TokensApi->registries_tokens_delete_with_http_info: #{e}"
end
```

### Parameters

| Name             | Type                                                                                                        | Description                   | Notes |
| ---------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------- | ----- |
| **registry\_id** | [**String**](https://github.com/ionos-cloud/sdk-ruby-container-registry/blob/master/docs/api/.md/README.md) | The unique ID of the registry |       |
| **token\_id**    | [**String**](https://github.com/ionos-cloud/sdk-ruby-container-registry/blob/master/docs/api/.md/README.md) | The unique ID of the token    |       |

### Return type

nil (empty response body)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## registries\_tokens\_find\_by\_id

> 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

### Examples

```ruby
require 'time'
require 'ionoscloud-container-registry'
# setup authorization
IonoscloudContainerRegistry.configure do |config|
  # Configure HTTP basic authorization: basicAuth
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'

  # Configure API key authorization: tokenAuth
  config.api_key['Authorization'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['Authorization'] = 'Bearer'
end

api_instance = IonoscloudContainerRegistry::TokensApi.new
registry_id = TODO # String | The unique ID of the registry
token_id = TODO # String | The unique ID of the token

begin
  # Get token information
  result = api_instance.registries_tokens_find_by_id(registry_id, token_id)
  p result
rescue IonoscloudContainerRegistry::ApiError => e
  puts "Error when calling TokensApi->registries_tokens_find_by_id: #{e}"
end
```

#### Using the registries\_tokens\_find\_by\_id\_with\_http\_info variant

This returns an Array which contains the response data, status code and headers.

> \<Array(, Integer, Hash)> registries\_tokens\_find\_by\_id\_with\_http\_info(registry\_id, token\_id)

```ruby
begin
  # Get token information
  data, status_code, headers = api_instance.registries_tokens_find_by_id_with_http_info(registry_id, token_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <TokenResponse>
rescue IonoscloudContainerRegistry::ApiError => e
  puts "Error when calling TokensApi->registries_tokens_find_by_id_with_http_info: #{e}"
end
```

### Parameters

| Name             | Type                                                                                                        | Description                   | Notes |
| ---------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------- | ----- |
| **registry\_id** | [**String**](https://github.com/ionos-cloud/sdk-ruby-container-registry/blob/master/docs/api/.md/README.md) | The unique ID of the registry |       |
| **token\_id**    | [**String**](https://github.com/ionos-cloud/sdk-ruby-container-registry/blob/master/docs/api/.md/README.md) | The unique ID of the token    |       |

### Return type

[**TokenResponse**](https://github.com/ionos-cloud/sdk-ruby-container-registry/blob/master/docs/api/TokenResponse.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## registries\_tokens\_get

> registries\_tokens\_get(registry\_id, opts)

List all tokens for the container registry

### Examples

```ruby
require 'time'
require 'ionoscloud-container-registry'
# setup authorization
IonoscloudContainerRegistry.configure do |config|
  # Configure HTTP basic authorization: basicAuth
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'

  # Configure API key authorization: tokenAuth
  config.api_key['Authorization'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['Authorization'] = 'Bearer'
end

api_instance = IonoscloudContainerRegistry::TokensApi.new
registry_id = TODO # String | The unique ID of the registry
opts = {
  offset: 'offset_example', # String | The first element (from the complete list of the elements) to include in the response (used together with limit for pagination)
  limit: 'limit_example' # String | The maximum number of elements to return (used together with offset for pagination)
}

begin
  # List all tokens for the container registry
  result = api_instance.registries_tokens_get(registry_id, opts)
  p result
rescue IonoscloudContainerRegistry::ApiError => e
  puts "Error when calling TokensApi->registries_tokens_get: #{e}"
end
```

#### Using the registries\_tokens\_get\_with\_http\_info variant

This returns an Array which contains the response data, status code and headers.

> \<Array(, Integer, Hash)> registries\_tokens\_get\_with\_http\_info(registry\_id, opts)

```ruby
begin
  # List all tokens for the container registry
  data, status_code, headers = api_instance.registries_tokens_get_with_http_info(registry_id, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <TokensResponse>
rescue IonoscloudContainerRegistry::ApiError => e
  puts "Error when calling TokensApi->registries_tokens_get_with_http_info: #{e}"
end
```

### Parameters

| Name             | Type                                                                                                        | Description                                                                                                                     | Notes                          |
| ---------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ |
| **registry\_id** | [**String**](https://github.com/ionos-cloud/sdk-ruby-container-registry/blob/master/docs/api/.md/README.md) | The unique ID of the registry                                                                                                   |                                |
| **offset**       | **String**                                                                                                  | 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**        | **String**                                                                                                  | The maximum number of elements to return (used together with offset for pagination)                                             | \[optional]\[default to '100'] |

### Return type

[**TokensResponse**](https://github.com/ionos-cloud/sdk-ruby-container-registry/blob/master/docs/api/TokensResponse.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## registries\_tokens\_patch

> 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

### Examples

```ruby
require 'time'
require 'ionoscloud-container-registry'
# setup authorization
IonoscloudContainerRegistry.configure do |config|
  # Configure HTTP basic authorization: basicAuth
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'

  # Configure API key authorization: tokenAuth
  config.api_key['Authorization'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['Authorization'] = 'Bearer'
end

api_instance = IonoscloudContainerRegistry::TokensApi.new
registry_id = TODO # String | The unique ID of the registry
token_id = TODO # String | The unique ID of the token
patch_token_input = IonoscloudContainerRegistry::PatchTokenInput.new # PatchTokenInput | 

begin
  # Update token
  result = api_instance.registries_tokens_patch(registry_id, token_id, patch_token_input)
  p result
rescue IonoscloudContainerRegistry::ApiError => e
  puts "Error when calling TokensApi->registries_tokens_patch: #{e}"
end
```

#### Using the registries\_tokens\_patch\_with\_http\_info variant

This returns an Array which contains the response data, status code and headers.

> \<Array(, Integer, Hash)> registries\_tokens\_patch\_with\_http\_info(registry\_id, token\_id, patch\_token\_input)

```ruby
begin
  # Update token
  data, status_code, headers = api_instance.registries_tokens_patch_with_http_info(registry_id, token_id, patch_token_input)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <TokenResponse>
rescue IonoscloudContainerRegistry::ApiError => e
  puts "Error when calling TokensApi->registries_tokens_patch_with_http_info: #{e}"
end
```

### Parameters

| Name                    | Type                                                                                                                      | Description                   | Notes |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------- | ----- |
| **registry\_id**        | [**String**](https://github.com/ionos-cloud/sdk-ruby-container-registry/blob/master/docs/api/.md/README.md)               | The unique ID of the registry |       |
| **token\_id**           | [**String**](https://github.com/ionos-cloud/sdk-ruby-container-registry/blob/master/docs/api/.md/README.md)               | The unique ID of the token    |       |
| **patch\_token\_input** | [**PatchTokenInput**](https://github.com/ionos-cloud/sdk-ruby-container-registry/blob/master/docs/api/PatchTokenInput.md) |                               |       |

### Return type

[**TokenResponse**](https://github.com/ionos-cloud/sdk-ruby-container-registry/blob/master/docs/api/TokenResponse.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## registries\_tokens\_post

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

Create token

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

### Examples

```ruby
require 'time'
require 'ionoscloud-container-registry'
# setup authorization
IonoscloudContainerRegistry.configure do |config|
  # Configure HTTP basic authorization: basicAuth
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'

  # Configure API key authorization: tokenAuth
  config.api_key['Authorization'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['Authorization'] = 'Bearer'
end

api_instance = IonoscloudContainerRegistry::TokensApi.new
registry_id = TODO # String | The unique ID of the registry
post_token_input = IonoscloudContainerRegistry::PostTokenInput.new({properties: IonoscloudContainerRegistry::PostTokenProperties.new({name: 'push-token'})}) # PostTokenInput | 

begin
  # Create token
  result = api_instance.registries_tokens_post(registry_id, post_token_input)
  p result
rescue IonoscloudContainerRegistry::ApiError => e
  puts "Error when calling TokensApi->registries_tokens_post: #{e}"
end
```

#### Using the registries\_tokens\_post\_with\_http\_info variant

This returns an Array which contains the response data, status code and headers.

> \<Array(, Integer, Hash)> registries\_tokens\_post\_with\_http\_info(registry\_id, post\_token\_input)

```ruby
begin
  # Create token
  data, status_code, headers = api_instance.registries_tokens_post_with_http_info(registry_id, post_token_input)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <PostTokenOutput>
rescue IonoscloudContainerRegistry::ApiError => e
  puts "Error when calling TokensApi->registries_tokens_post_with_http_info: #{e}"
end
```

### Parameters

| Name                   | Type                                                                                                                    | Description                   | Notes |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------- | ----- |
| **registry\_id**       | [**String**](https://github.com/ionos-cloud/sdk-ruby-container-registry/blob/master/docs/api/.md/README.md)             | The unique ID of the registry |       |
| **post\_token\_input** | [**PostTokenInput**](https://github.com/ionos-cloud/sdk-ruby-container-registry/blob/master/docs/api/PostTokenInput.md) |                               |       |

### Return type

[**PostTokenOutput**](https://github.com/ionos-cloud/sdk-ruby-container-registry/blob/master/docs/api/PostTokenOutput.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## registries\_tokens\_put

> 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

### Examples

```ruby
require 'time'
require 'ionoscloud-container-registry'
# setup authorization
IonoscloudContainerRegistry.configure do |config|
  # Configure HTTP basic authorization: basicAuth
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'

  # Configure API key authorization: tokenAuth
  config.api_key['Authorization'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['Authorization'] = 'Bearer'
end

api_instance = IonoscloudContainerRegistry::TokensApi.new
registry_id = TODO # String | The unique ID of the registry
token_id = 'token_id_example' # String | The unique ID of the token
put_token_input = IonoscloudContainerRegistry::PutTokenInput.new({properties: IonoscloudContainerRegistry::PostTokenProperties.new({name: 'push-token'})}) # PutTokenInput | 

begin
  # Create or replace token
  result = api_instance.registries_tokens_put(registry_id, token_id, put_token_input)
  p result
rescue IonoscloudContainerRegistry::ApiError => e
  puts "Error when calling TokensApi->registries_tokens_put: #{e}"
end
```

#### Using the registries\_tokens\_put\_with\_http\_info variant

This returns an Array which contains the response data, status code and headers.

> \<Array(, Integer, Hash)> registries\_tokens\_put\_with\_http\_info(registry\_id, token\_id, put\_token\_input)

```ruby
begin
  # Create or replace token
  data, status_code, headers = api_instance.registries_tokens_put_with_http_info(registry_id, token_id, put_token_input)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <PutTokenOutput>
rescue IonoscloudContainerRegistry::ApiError => e
  puts "Error when calling TokensApi->registries_tokens_put_with_http_info: #{e}"
end
```

### Parameters

| Name                  | Type                                                                                                                  | Description                   | Notes |
| --------------------- | --------------------------------------------------------------------------------------------------------------------- | ----------------------------- | ----- |
| **registry\_id**      | [**String**](https://github.com/ionos-cloud/sdk-ruby-container-registry/blob/master/docs/api/.md/README.md)           | The unique ID of the registry |       |
| **token\_id**         | **String**                                                                                                            | The unique ID of the token    |       |
| **put\_token\_input** | [**PutTokenInput**](https://github.com/ionos-cloud/sdk-ruby-container-registry/blob/master/docs/api/PutTokenInput.md) |                               |       |

### Return type

[**PutTokenOutput**](https://github.com/ionos-cloud/sdk-ruby-container-registry/blob/master/docs/api/PutTokenOutput.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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


---

# Agent Instructions: 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:

```
GET https://docs.ionos.com/container-registry-sdk-ruby/api/tokensapi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
