---
title: /auth/refresh
slug: authrefresh
docTags: 
createdAt: 2023-07-20T14:59:31.346Z
---

{
  "id": "FZd8_gk5xD391FPh9hCqU",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "/auth/refresh",
    "name": "/auth/refresh",
    "description": "Atualiza token de acesso a api.",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "customType": "RefreshTokenDto",
          "schema": [
            {
              "name": "refresh_token",
              "kind": "required",
              "type": "string",
              "description": "Token para atualizar o acesso a api",
              "example": "RFT-abcd1234-abcd-1234-abcd-abcd1234efgh"
            }
          ],
          "modelRef": "#/components/schemas/RefreshTokenDto",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "Token atualizado com sucesso",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "customType": "ConfigurationUserTokensDto",
            "schema": [
              {
                "name": "access_token",
                "kind": "required",
                "type": "string",
                "description": "Token de acesso a api",
                "example": "APP_OCK-abcd1234-abcd-1234-abcd-abcd1234efgh"
              },
              {
                "name": "access_token_expire_at",
                "kind": "required",
                "type": "string<date-time>",
                "description": "Data de expiração do token de acesso"
              },
              {
                "name": "refresh_token",
                "kind": "required",
                "type": "string",
                "description": "Token para atualizar o acesso a api",
                "example": "RFT-abcd1234-abcd-1234-abcd-abcd1234efgh"
              }
            ],
            "modelRef": "#/components/schemas/ConfigurationUserTokensDto",
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "297H0m27Gt0uWHLUHZQCr",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url /auth/refresh \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"refresh_token\": \"RFT-abcd1234-abcd-1234-abcd-abcd1234efgh\"\n     }'"
        },
        {
          "id": "_AsNqY6oinpFVDDiU8Isq",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"refresh_token\": \"RFT-abcd1234-abcd-1234-abcd-abcd1234efgh\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"/auth/refresh\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "-DRtt3DKiepMyK3SuuwnB",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"/auth/refresh\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"refresh_token\": \"RFT-abcd1234-abcd-1234-abcd-abcd1234efgh\"\n})\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "2nrDCHmM2xVb2BoyujvzC",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"/auth/refresh\"\n\npayload = json.dumps({\n   \"refresh_token\": \"RFT-abcd1234-abcd-1234-abcd-abcd1234efgh\"\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "297H0m27Gt0uWHLUHZQCr"
    },
    "results": {
      "languages": [
        {
          "id": "Ly8bq07PGWUOWSS9AyrTu",
          "language": "201",
          "code": "// Token atualizado com sucesso\n{\n  \"access_token\": \"APP_OCK-abcd1234-abcd-1234-abcd-abcd1234efgh\",\n  \"access_token_expire_at\": \"\",\n  \"refresh_token\": \"RFT-abcd1234-abcd-1234-abcd-abcd1234efgh\"\n}"
        }
      ],
      "selectedLanguageId": "Ly8bq07PGWUOWSS9AyrTu"
    }
  },
  "children": [
    {
      "id": "WeC_PoGFOXTf0zB1TuYNE",
      "type": "paragraph",
      "children": [
        {
          "text": "Atualiza token de acesso a api."
        }
      ]
    }
  ]
}