# Gestión de tokens desde la CLI

### 1. Listar tokens existentes <a href="#id-1-listar-tokens-existentes" id="id-1-listar-tokens-existentes"></a>

Muestra todos los tokens disponibles y sus permisos:

{% code title="bash" overflow="wrap" %}

```bash
influx auth list
```

{% endcode %}

Puedes filtrar por usuario, organización o tipo de permiso usando opciones adicionales.

***

### 2. Crear un nuevo token <a href="#id-2-crear-un-nuevo-token" id="id-2-crear-un-nuevo-token"></a>

Crea un token con permisos específicos. Ejemplo para acceso total a una organización:

{% code title="bash" overflow="wrap" %}

```bash
influx auth create --org NOMBRE_ORG --token TU_TOKEN_ACTUAL --all-access
```

{% endcode %}

Para permisos más granulares (lectura/escritura en buckets específicos):

{% code title="bash" overflow="wrap" %}

```bash
influx auth create --org NOMBRE_ORG --token TU_TOKEN_ACTUAL --read-bucket BUCKET_ID --write-bucket BUCKET_ID
```

{% endcode %}

El valor del token solo se muestra justo después de crearlo.

***

### 3. Ver detalles de un token <a href="#id-3-ver-detalles-de-un-token" id="id-3-ver-detalles-de-un-token"></a>

Filtra la lista para ver los detalles de uno específico:

{% code title="bash" overflow="wrap" %}

```bash
influx auth list --user USER_ID
```

{% endcode %}

***

### 4. Inactivar un token <a href="#id-4-inactivar-un-token" id="id-4-inactivar-un-token"></a>

Desactiva un token temporalmente (no lo elimina):

{% code title="bash" overflow="wrap" %}

```bash
influx auth inactive -i TOKEN_ID
```

{% endcode %}

Esto impide que el token autorice nuevas solicitudes, pero permite reactivarlo más tarde.

***

### 5. Eliminar un token <a href="#id-5-eliminar-un-token" id="id-5-eliminar-un-token"></a>

Elimina un token de forma definitiva:

{% code title="bash" overflow="wrap" %}

```bash
influx auth delete -i TOKEN_ID
```

{% endcode %}

Sustituye `TOKEN_ID` por el identificador del token que quieres eliminar.


---

# 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://darioaplicano.gitbook.io/influxdb2.x/sesion-4/guion-de-la-sesion/documentacion/seguridad-y-gestion-de-accesos/autenticacion-y-autorizacion/gestion-de-tokens-desde-la-cli.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.
