---
updatedAt: 2026-11-12T11:00:37.000Z
agentTools:
  projectIndex: https://es-developers.kommo.com/llms.txt
---

# Obtener/renovar un token de acceso

El método te permite intercambiar un código de autorización por un token de acceso y un token de actualización.

**Encabezado de tipo de datos cuando la solicitud es exitosa**
Content-Type: application/json

**Encabezado de tipo de datos en caso de error**<br />Content-Type: application/json

**Ejemplo de cuerpo de la solicitud (obtener un código de acceso y un código de actualización)**

```json
{
  "client_id": "xxxx",
  "client_secret": "xxxx",
  "grant_type": "authorization_code",
  "code": "xxxxxxx",
  "redirect_uri": "https://test.test"
}
```

**Ejemplo de cuerpo de la solicitud (obtener un nuevo token de acceso una vez que expire)**

```json
{
 "client_id": "xxxx",
  "client_secret": "xxxx",
  "grant_type": "refresh_token",
  "refresh_token": "xxxxx",
  "redirect_uri": "https://test.test"
}
```

## Parámetros de respuesta

| Parámetro      | Tipo de dato | Descripción                                              |
| :------------- | :----------- | :------------------------------------------------------- |
| token\_type    | string       | Tipo de token (Bearer)                                   |
| expires\_in    | int          | Tiempo en segundos, que muestra cuándo expirará el token |
| server\_time   | int          | Hora de emisión del token en el servidor                 |
| access\_token  | string       | Token de acceso                                          |
| refresh\_token | string       | Token de actualización                                   |

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "kommo-api",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://{subdominio}.kommo.com",
      "variables": {
        "subdominio": {
          "default": "subdominio"
        }
      }
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "oauth2",
        "flows": {}
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/oauth2/access_token": {
      "post": {
        "summary": "Obtener/renovar un token de acceso",
        "description": "El método te permite intercambiar un código de autorización por un token de acceso y un token de actualización.",
        "operationId": "token-de-acceso",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "description": "ID de la integración"
                  },
                  "client_secret": {
                    "type": "string",
                    "description": "Clave secreta. Opcional para actualizar un token de acceso"
                  },
                  "grant_type": {
                    "type": "string",
                    "description": "Tipo de datos de autorización (para código de autorización: authorization_code, para token de actualización: refresh_token)",
                    "enum": [
                      "authorization_code",
                      "refresh_token"
                    ]
                  },
                  "code": {
                    "type": "string",
                    "description": "Tu código de autorización"
                  },
                  "refresh_token": {
                    "type": "string",
                    "description": "Token de actualización"
                  },
                  "redirect_uri": {
                    "type": "string",
                    "description": "URI de redirección indicada en la configuración de la integración"
                  }
                }
              },
              "examples": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK ",
            "content": {
              "application/json": {
                "examples": {
                  "Solicitud procesada con éxito": {
                    "value": {
                      "token_type": "Bearer",
                      "expires_in": 86400,
                      "server_time": 1751892369,
                      "access_token": "xxxxxx",
                      "refresh_token": "xxxxx"
                    }
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "token_type": {
                      "type": "string",
                      "example": "Bearer"
                    },
                    "expires_in": {
                      "type": "integer",
                      "example": 86400,
                      "default": 0
                    },
                    "server_time": {
                      "type": "integer",
                      "example": 1751892369,
                      "default": 0
                    },
                    "access_token": {
                      "type": "string",
                      "example": "xxxxxx"
                    },
                    "refresh_token": {
                      "type": "string",
                      "example": "xxxxx"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "examples": {
                  "El URI de redirección no está asociado al cliente": {
                    "value": {
                      "hint": "Redirect URI is not associated with client",
                      "title": "Invalid request",
                      "type": "https://developers.amocrm.ru/v3/errors/OAuthProblemJson",
                      "status": 400,
                      "detail": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."
                    },
                    "summary": "El URI de redirección no está asociado al cliente"
                  },
                  "Código de autorización no válido": {
                    "summary": "Código de autorización no válido",
                    "value": {
                      "hint": "Cannot decrypt the authorization code",
                      "title": "Invalid request",
                      "type": "https://developers.amocrm.ru/v3/errors/OAuthProblemJson",
                      "status": 400,
                      "detail": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."
                    }
                  },
                  "El código de autorización ha caducado": {
                    "summary": "El código de autorización ha caducado",
                    "value": {
                      "hint": "Authorization code has expired",
                      "title": "Invalid request",
                      "type": "https://developers.amocrm.ru/v3/errors/OAuthProblemJson",
                      "status": 400,
                      "detail": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."
                    }
                  },
                  "ID de integración no válido": {
                    "summary": "ID de integración no válido",
                    "value": {
                      "hint": "Check the `client_id` parameter",
                      "title": "Invalid request",
                      "type": "https://developers.amocrm.ru/v3/errors/OAuthProblemJson",
                      "status": 400,
                      "detail": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."
                    }
                  },
                  "Clave secreta de integración no válida": {
                    "summary": "Clave secreta de integración no válida",
                    "value": {
                      "hint": "Check the `client_secret` parameter",
                      "title": "Invalid request",
                      "type": "https://developers.amocrm.ru/v3/errors/OAuthProblemJson",
                      "status": 400,
                      "detail": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."
                    }
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "hint": {
                      "type": "string",
                      "example": "Redirect URI is not associated with client"
                    },
                    "title": {
                      "type": "string",
                      "example": "Invalid request"
                    },
                    "type": {
                      "type": "string",
                      "example": "https://developers.amocrm.ru/v3/errors/OAuthProblemJson"
                    },
                    "status": {
                      "type": "integer",
                      "example": 400,
                      "default": 0
                    },
                    "detail": {
                      "type": "string",
                      "example": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "x-readme": {
    "headers": [
      {
        "key": "Content-Type",
        "value": "application/json"
      }
    ],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```