# TokensApi

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

| Method                                                    | HTTP request                                         | Description                                |
| --------------------------------------------------------- | ---------------------------------------------------- | ------------------------------------------ |
| [**registriesTokensDelete**](#registriestokensdelete)     | **DELETE** /registries/{registryId}/tokens/{tokenId} | Delete token                               |
| [**registriesTokensFindById**](#registriestokensfindbyid) | **GET** /registries/{registryId}/tokens/{tokenId}    | Get token information                      |
| [**registriesTokensGet**](#registriestokensget)           | **GET** /registries/{registryId}/tokens              | List all tokens for the container registry |
| [**registriesTokensPatch**](#registriestokenspatch)       | **PATCH** /registries/{registryId}/tokens/{tokenId}  | Update token                               |
| [**registriesTokensPost**](#registriestokenspost)         | **POST** /registries/{registryId}/tokens             | Create token                               |
| [**registriesTokensPut**](#registriestokensput)           | **PUT** /registries/{registryId}/tokens/{tokenId}    | Create or replace token                    |

## registriesTokensDelete

> registriesTokensDelete(registryId, tokenId)

Delete token

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs-container-registry');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.TokensApi(config);
// Delete token
api_instance
  .registriesTokensDelete({
    registryId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
    tokenId: 38400000-8cf0-11bd-b23e-10b96e4ef00d
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name           | Type                                                                                                             | Description                   | Notes                   |
| -------------- | ---------------------------------------------------------------------------------------------------------------- | ----------------------------- | ----------------------- |
| **registryId** | [**string**](https://github.com/ionos-cloud/sdk-nodejs-container-registry/blob/master/docs/models/.md/README.md) | The unique ID of the registry | \[default to undefined] |
| **tokenId**    | [**string**](https://github.com/ionos-cloud/sdk-nodejs-container-registry/blob/master/docs/models/.md/README.md) | The unique ID of the token    | \[default to undefined] |

### Return type

nil (empty response body)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## registriesTokensFindById

> registriesTokensFindById(registryId, tokenId)

Get token information

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

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs-container-registry');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.TokensApi(config);
// Get token information
api_instance
  .registriesTokensFindById({
    registryId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
    tokenId: 38400000-8cf0-11bd-b23e-10b96e4ef00d
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name           | Type                                                                                                             | Description                   | Notes                   |
| -------------- | ---------------------------------------------------------------------------------------------------------------- | ----------------------------- | ----------------------- |
| **registryId** | [**string**](https://github.com/ionos-cloud/sdk-nodejs-container-registry/blob/master/docs/models/.md/README.md) | The unique ID of the registry | \[default to undefined] |
| **tokenId**    | [**string**](https://github.com/ionos-cloud/sdk-nodejs-container-registry/blob/master/docs/models/.md/README.md) | The unique ID of the token    | \[default to undefined] |

### Return type

[**TokenResponse**](/container-registry-sdk-nodejs/models/tokenresponse.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## registriesTokensGet

> registriesTokensGet(registryId, opts)

List all tokens for the container registry

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs-container-registry');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.TokensApi(config);
var filterMap = new Map()
filterMap.set("<property_name>", "<property_value>")
// List all tokens for the container registry
api_instance
  .registriesTokensGet({
    registryId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
    offset: offset_example,
    limit: limit_example, 
    maxResults: 2,
    filters: filterMap
    options: {}
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name           | Type                                                                                                             | Description                                                                                                                     | Notes                          |
| -------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ |
| **registryId** | [**string**](https://github.com/ionos-cloud/sdk-nodejs-container-registry/blob/master/docs/models/.md/README.md) | The unique ID of the registry                                                                                                   | \[default to undefined]        |
| **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**](/container-registry-sdk-nodejs/models/tokensresponse.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## registriesTokensPatch

> registriesTokensPatch(registryId, tokenId, patchTokenInput)

Update token

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

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs-container-registry');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.TokensApi(config);
// Update token
api_instance
  .registriesTokensPatch({
    registryId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
    tokenId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
    patchTokenInput: patchTokenInput_example
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name                | Type                                                                                                             | Description                   | Notes                   |
| ------------------- | ---------------------------------------------------------------------------------------------------------------- | ----------------------------- | ----------------------- |
| **registryId**      | [**string**](https://github.com/ionos-cloud/sdk-nodejs-container-registry/blob/master/docs/models/.md/README.md) | The unique ID of the registry | \[default to undefined] |
| **tokenId**         | [**string**](https://github.com/ionos-cloud/sdk-nodejs-container-registry/blob/master/docs/models/.md/README.md) | The unique ID of the token    | \[default to undefined] |
| **patchTokenInput** | [**PatchTokenInput**](/container-registry-sdk-nodejs/models/patchtokeninput.md)                                  |                               |                         |

### Return type

[**TokenResponse**](/container-registry-sdk-nodejs/models/tokenresponse.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## registriesTokensPost

> registriesTokensPost(registryId, postTokenInput)

Create token

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

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs-container-registry');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.TokensApi(config);
// Create token
api_instance
  .registriesTokensPost({
    registryId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
    postTokenInput: postTokenInput_example
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name               | Type                                                                                                             | Description                   | Notes                   |
| ------------------ | ---------------------------------------------------------------------------------------------------------------- | ----------------------------- | ----------------------- |
| **registryId**     | [**string**](https://github.com/ionos-cloud/sdk-nodejs-container-registry/blob/master/docs/models/.md/README.md) | The unique ID of the registry | \[default to undefined] |
| **postTokenInput** | [**PostTokenInput**](/container-registry-sdk-nodejs/models/posttokeninput.md)                                    |                               |                         |

### Return type

[**PostTokenOutput**](/container-registry-sdk-nodejs/models/posttokenoutput.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## registriesTokensPut

> registriesTokensPut(registryId, tokenId, putTokenInput)

Create or replace token

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

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs-container-registry');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.TokensApi(config);
// Create or replace token
api_instance
  .registriesTokensPut({
    registryId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
    tokenId: tokenId_example,
    putTokenInput: putTokenInput_example
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name              | Type                                                                                                             | Description                   | Notes                   |
| ----------------- | ---------------------------------------------------------------------------------------------------------------- | ----------------------------- | ----------------------- |
| **registryId**    | [**string**](https://github.com/ionos-cloud/sdk-nodejs-container-registry/blob/master/docs/models/.md/README.md) | The unique ID of the registry | \[default to undefined] |
| **tokenId**       | **string**                                                                                                       | The unique ID of the token    | \[default to undefined] |
| **putTokenInput** | [**PutTokenInput**](/container-registry-sdk-nodejs/models/puttokeninput.md)                                      |                               |                         |

### Return type

[**PutTokenOutput**](/container-registry-sdk-nodejs/models/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-nodejs/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.
