---
title: Refresh access token
slug: api-documentation/refresh-access-token
docTags: 
createdAt: 2026-08-27T16:53:30.249Z
---

{
  "id": "bc2egKbhxuC4uHfgnFwOh",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.upstartcommerce.com/api/v1/auth/refresh",
    "servers": [
      {
        "url": "https://api.upstartcommerce.com/api/v1/auth/refresh",
        "description": "Production"
      }
    ],
    "name": "Refresh access token",
    "description": "<p>Exchange a valid refresh token for a new access token and refresh token pair.</p>\n<p><strong>Token Rotation</strong>: Each refresh operation issues a new refresh token and\ninvalidates the previous one. This limits the window of exposure if a\nrefresh token is compromised.</p>\n<p><strong>Tenant Switching</strong>: Optionally switch to a different authorized tenant\nby including the <code>tenant</code> parameter. The new tenant must be in the user's\nlist of authorized tenants.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "Refresh token for obtaining new access token",
          "customType": "RefreshRequest",
          "schema": [
            {
              "name": "refreshToken",
              "kind": "required",
              "type": "string",
              "description": "Valid refresh token from previous login or refresh",
              "example": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
            },
            {
              "name": "tenant",
              "kind": "optional",
              "type": "string",
              "description": "Optional tenant to switch to during refresh.\nMust be in the user's list of authorized tenants.\n",
              "example": "tenant-456"
            },
            {
              "name": "site",
              "kind": "optional",
              "type": "string",
              "description": "Optional site to switch to during refresh.\nMust be in the user's list of authorized sites for the target tenant.\n",
              "example": "site-123"
            }
          ],
          "modelRef": "#/components/schemas/RefreshRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Token refresh successful",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"accessToken\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\",\"refreshToken\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\",\"expiresIn\":3600,\"tokenType\":\"Bearer\"}",
            "description": "Successful authentication response containing tokens",
            "customType": "AuthResponse",
            "schema": [
              {
                "name": "accessToken",
                "kind": "required",
                "type": "string",
                "description": "<p>JWT access token for API authorization.</p>\n<p>Include in API requests as: <code>Authorization: Bearer &#x3C;accessToken></code></p>\n<p><strong>Claims</strong>:</p>\n<ul>\n<li><code>sub</code>: User ID (UUID)</li>\n<li><code>type</code>: Token type (consumer/management)</li>\n<li><code>roles</code>: List of role identifiers</li>\n<li><code>tenant</code>: Active tenant ID</li>\n<li><code>iat</code>: Issued at (Unix timestamp)</li>\n<li><code>exp</code>: Expiration (Unix timestamp)</li>\n<li><code>iss</code>: Issuer (auth-svc)</li>\n</ul>",
                "example": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1NTBl..."
              },
              {
                "name": "refreshToken",
                "kind": "required",
                "type": "string",
                "description": "<p>Refresh token for obtaining new access tokens.</p>\n<p>Store securely (e.g., httpOnly cookie or secure storage).\nUse with <code>/api/v1/auth/refresh</code> when access token expires.</p>",
                "example": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1NTBl..."
              },
              {
                "name": "expiresIn",
                "kind": "required",
                "type": "integer<int64>",
                "description": "Access token validity duration in seconds",
                "example": 3600,
                "format": "int64"
              },
              {
                "name": "tokenType",
                "kind": "required",
                "type": "string",
                "description": "<p>Token type (always \"Bearer\")</p>",
                "example": "Bearer"
              }
            ],
            "modelRef": "#/components/schemas/AuthResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Invalid request body",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"error\":\"invalid_request\",\"message\":\"Failed to read request body\",\"code\":\"BAD_REQUEST\"}",
            "description": "Standard error response format",
            "customType": "ErrorResponse",
            "schema": [
              {
                "name": "error",
                "kind": "required",
                "type": "string",
                "description": "<p>Error type identifier:</p>\n<ul>\n<li><code>invalid_request</code>: Malformed request or missing required fields</li>\n<li><code>unauthorized</code>: Invalid credentials or token</li>\n<li><code>account_not_verified</code>: Account exists but email/phone not verified</li>\n<li><code>session_expired</code>: Maximum session lifetime exceeded, full re-login required</li>\n<li><code>unauthorized_tenant</code>: User not authorized for requested tenant</li>\n<li><code>tenant_required</code>: Multi-tenant user must specify tenant</li>\n<li><code>unauthorized_site</code>: User not authorized for requested site</li>\n<li><code>site_required</code>: Site context required for this operation</li>\n<li><code>no_authorized_sites</code>: User has no authorized sites</li>\n<li><code>forbidden</code>: Access denied (e.g., no authorized tenants)</li>\n<li><code>rate_limited</code>: Too many requests, try again later</li>\n<li><code>account_locked</code>: Account temporarily locked due to failed attempts</li>\n<li><code>internal_error</code>: Server-side error</li>\n</ul>",
                "example": "unauthorized"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "<p>Human-readable error description</p>",
                "example": "Invalid username or password"
              },
              {
                "name": "code",
                "kind": "required",
                "type": "string<BAD_REQUEST | UNAUTHORIZED | UNAUTHORIZED_TENANT | TENANT_REQUIRED | FORBIDDEN | RATE_LIMITED | ACCOUNT_LOCKED | INTERNAL_SERVER_ERROR>",
                "description": "HTTP status code name",
                "example": "UNAUTHORIZED",
                "enum": [
                  "BAD_REQUEST",
                  "UNAUTHORIZED",
                  "UNAUTHORIZED_TENANT",
                  "TENANT_REQUIRED",
                  "FORBIDDEN",
                  "RATE_LIMITED",
                  "ACCOUNT_LOCKED",
                  "INTERNAL_SERVER_ERROR"
                ]
              }
            ],
            "modelRef": "#/components/schemas/ErrorResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "<p>Invalid, expired, or revoked refresh token</p>",
        "jsonExample": "",
        "isExpanded": true,
        "subExamples": [
          {
            "label": "GENERATED",
            "code": "// Invalid, expired, or revoked refresh token\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid username or password\",\n  \"code\": \"UNAUTHORIZED\"\n}"
          },
          {
            "label": "invalidToken",
            "code": "// Invalid token\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid refresh token\",\n  \"code\": \"UNAUTHORIZED\"\n}"
          },
          {
            "label": "expiredToken",
            "code": "// Expired token\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Refresh token has expired\",\n  \"code\": \"UNAUTHORIZED\"\n}"
          },
          {
            "label": "revokedToken",
            "code": "// Revoked token\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Refresh token has been revoked\",\n  \"code\": \"UNAUTHORIZED\"\n}"
          }
        ],
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Standard error response format",
            "customType": "ErrorResponse",
            "schema": [
              {
                "name": "error",
                "kind": "required",
                "type": "string",
                "description": "<p>Error type identifier:</p>\n<ul>\n<li><code>invalid_request</code>: Malformed request or missing required fields</li>\n<li><code>unauthorized</code>: Invalid credentials or token</li>\n<li><code>account_not_verified</code>: Account exists but email/phone not verified</li>\n<li><code>session_expired</code>: Maximum session lifetime exceeded, full re-login required</li>\n<li><code>unauthorized_tenant</code>: User not authorized for requested tenant</li>\n<li><code>tenant_required</code>: Multi-tenant user must specify tenant</li>\n<li><code>unauthorized_site</code>: User not authorized for requested site</li>\n<li><code>site_required</code>: Site context required for this operation</li>\n<li><code>no_authorized_sites</code>: User has no authorized sites</li>\n<li><code>forbidden</code>: Access denied (e.g., no authorized tenants)</li>\n<li><code>rate_limited</code>: Too many requests, try again later</li>\n<li><code>account_locked</code>: Account temporarily locked due to failed attempts</li>\n<li><code>internal_error</code>: Server-side error</li>\n</ul>",
                "example": "unauthorized"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "<p>Human-readable error description</p>",
                "example": "Invalid username or password"
              },
              {
                "name": "code",
                "kind": "required",
                "type": "string<BAD_REQUEST | UNAUTHORIZED | UNAUTHORIZED_TENANT | TENANT_REQUIRED | FORBIDDEN | RATE_LIMITED | ACCOUNT_LOCKED | INTERNAL_SERVER_ERROR>",
                "description": "HTTP status code name",
                "example": "UNAUTHORIZED",
                "enum": [
                  "BAD_REQUEST",
                  "UNAUTHORIZED",
                  "UNAUTHORIZED_TENANT",
                  "TENANT_REQUIRED",
                  "FORBIDDEN",
                  "RATE_LIMITED",
                  "ACCOUNT_LOCKED",
                  "INTERNAL_SERVER_ERROR"
                ]
              }
            ],
            "modelRef": "#/components/schemas/ErrorResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "403",
        "description": "Unauthorized tenant switch",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"error\":\"unauthorized_tenant\",\"message\":\"User is not authorized for tenant: tenant-xyz\",\"code\":\"UNAUTHORIZED_TENANT\"}",
            "description": "Standard error response format",
            "customType": "ErrorResponse",
            "schema": [
              {
                "name": "error",
                "kind": "required",
                "type": "string",
                "description": "<p>Error type identifier:</p>\n<ul>\n<li><code>invalid_request</code>: Malformed request or missing required fields</li>\n<li><code>unauthorized</code>: Invalid credentials or token</li>\n<li><code>account_not_verified</code>: Account exists but email/phone not verified</li>\n<li><code>session_expired</code>: Maximum session lifetime exceeded, full re-login required</li>\n<li><code>unauthorized_tenant</code>: User not authorized for requested tenant</li>\n<li><code>tenant_required</code>: Multi-tenant user must specify tenant</li>\n<li><code>unauthorized_site</code>: User not authorized for requested site</li>\n<li><code>site_required</code>: Site context required for this operation</li>\n<li><code>no_authorized_sites</code>: User has no authorized sites</li>\n<li><code>forbidden</code>: Access denied (e.g., no authorized tenants)</li>\n<li><code>rate_limited</code>: Too many requests, try again later</li>\n<li><code>account_locked</code>: Account temporarily locked due to failed attempts</li>\n<li><code>internal_error</code>: Server-side error</li>\n</ul>",
                "example": "unauthorized"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "<p>Human-readable error description</p>",
                "example": "Invalid username or password"
              },
              {
                "name": "code",
                "kind": "required",
                "type": "string<BAD_REQUEST | UNAUTHORIZED | UNAUTHORIZED_TENANT | TENANT_REQUIRED | FORBIDDEN | RATE_LIMITED | ACCOUNT_LOCKED | INTERNAL_SERVER_ERROR>",
                "description": "HTTP status code name",
                "example": "UNAUTHORIZED",
                "enum": [
                  "BAD_REQUEST",
                  "UNAUTHORIZED",
                  "UNAUTHORIZED_TENANT",
                  "TENANT_REQUIRED",
                  "FORBIDDEN",
                  "RATE_LIMITED",
                  "ACCOUNT_LOCKED",
                  "INTERNAL_SERVER_ERROR"
                ]
              }
            ],
            "modelRef": "#/components/schemas/ErrorResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "500",
        "description": "Internal server error",
        "jsonExample": "",
        "isExpanded": true,
        "subExamples": [
          {
            "label": "GENERATED",
            "code": "// Internal server error\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid username or password\",\n  \"code\": \"UNAUTHORIZED\"\n}"
          },
          {
            "label": "tokenGenerationFailed",
            "code": "// Token generation failed\n{\n  \"error\": \"internal_error\",\n  \"message\": \"Token generation failed\",\n  \"code\": \"INTERNAL_SERVER_ERROR\"\n}"
          },
          {
            "label": "serviceError",
            "code": "// Upstream service error\n{\n  \"error\": \"internal_error\",\n  \"message\": \"Failed to communicate with authentication backend\",\n  \"code\": \"INTERNAL_SERVER_ERROR\"\n}"
          }
        ],
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Standard error response format",
            "customType": "ErrorResponse",
            "schema": [
              {
                "name": "error",
                "kind": "required",
                "type": "string",
                "description": "<p>Error type identifier:</p>\n<ul>\n<li><code>invalid_request</code>: Malformed request or missing required fields</li>\n<li><code>unauthorized</code>: Invalid credentials or token</li>\n<li><code>account_not_verified</code>: Account exists but email/phone not verified</li>\n<li><code>session_expired</code>: Maximum session lifetime exceeded, full re-login required</li>\n<li><code>unauthorized_tenant</code>: User not authorized for requested tenant</li>\n<li><code>tenant_required</code>: Multi-tenant user must specify tenant</li>\n<li><code>unauthorized_site</code>: User not authorized for requested site</li>\n<li><code>site_required</code>: Site context required for this operation</li>\n<li><code>no_authorized_sites</code>: User has no authorized sites</li>\n<li><code>forbidden</code>: Access denied (e.g., no authorized tenants)</li>\n<li><code>rate_limited</code>: Too many requests, try again later</li>\n<li><code>account_locked</code>: Account temporarily locked due to failed attempts</li>\n<li><code>internal_error</code>: Server-side error</li>\n</ul>",
                "example": "unauthorized"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "<p>Human-readable error description</p>",
                "example": "Invalid username or password"
              },
              {
                "name": "code",
                "kind": "required",
                "type": "string<BAD_REQUEST | UNAUTHORIZED | UNAUTHORIZED_TENANT | TENANT_REQUIRED | FORBIDDEN | RATE_LIMITED | ACCOUNT_LOCKED | INTERNAL_SERVER_ERROR>",
                "description": "HTTP status code name",
                "example": "UNAUTHORIZED",
                "enum": [
                  "BAD_REQUEST",
                  "UNAUTHORIZED",
                  "UNAUTHORIZED_TENANT",
                  "TENANT_REQUIRED",
                  "FORBIDDEN",
                  "RATE_LIMITED",
                  "ACCOUNT_LOCKED",
                  "INTERNAL_SERVER_ERROR"
                ]
              }
            ],
            "modelRef": "#/components/schemas/ErrorResponse",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "p1Do_RwXHvjqMY2NLp0gp",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.upstartcommerce.com/api/v1/auth/refresh \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"refreshToken\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\"\n     }'"
        },
        {
          "id": "k18FAdpn7ZGD5amhCBLhX",
          "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   \"refreshToken\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.upstartcommerce.com/api/v1/auth/refresh\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "1CsrmdzemLoaR7MWX5El3",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.upstartcommerce.com/api/v1/auth/refresh\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"refreshToken\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "jtmRggPHqdIr0JUUCgizB",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.upstartcommerce.com/api/v1/auth/refresh\"\n\npayload = json.dumps({\n   \"refreshToken\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\"\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": "p1Do_RwXHvjqMY2NLp0gp"
    },
    "results": {
      "languages": [
        {
          "id": "RcHUaMt4VJOHxzBlvXHod",
          "language": "200",
          "code": "// Token refresh successful\n{\n  \"accessToken\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1NTBl...\",\n  \"refreshToken\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1NTBl...\",\n  \"expiresIn\": 3600,\n  \"tokenType\": \"Bearer\"\n}"
        },
        {
          "id": "muIBwvapr-CeJUp-zo08q",
          "language": "400",
          "code": "// Invalid request body\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid username or password\",\n  \"code\": \"UNAUTHORIZED\"\n}"
        },
        {
          "id": "-VX_3G4aClJ-y5k89yGE0",
          "language": "401",
          "code": "// Invalid, expired, or revoked refresh token\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid username or password\",\n  \"code\": \"UNAUTHORIZED\"\n}",
          "subExamples": [
            {
              "label": "GENERATED",
              "code": "// Invalid, expired, or revoked refresh token\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid username or password\",\n  \"code\": \"UNAUTHORIZED\"\n}"
            },
            {
              "label": "invalidToken",
              "code": "// Invalid token\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid refresh token\",\n  \"code\": \"UNAUTHORIZED\"\n}"
            },
            {
              "label": "expiredToken",
              "code": "// Expired token\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Refresh token has expired\",\n  \"code\": \"UNAUTHORIZED\"\n}"
            },
            {
              "label": "revokedToken",
              "code": "// Revoked token\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Refresh token has been revoked\",\n  \"code\": \"UNAUTHORIZED\"\n}"
            }
          ]
        },
        {
          "id": "gWf4D-5kSS0Vt9N-Bbv13",
          "language": "403",
          "code": "// Unauthorized tenant switch\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid username or password\",\n  \"code\": \"UNAUTHORIZED\"\n}"
        },
        {
          "id": "LELs0FmyqMcV0cv3HpvI2",
          "language": "500",
          "code": "// Internal server error\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid username or password\",\n  \"code\": \"UNAUTHORIZED\"\n}",
          "subExamples": [
            {
              "label": "GENERATED",
              "code": "// Internal server error\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid username or password\",\n  \"code\": \"UNAUTHORIZED\"\n}"
            },
            {
              "label": "tokenGenerationFailed",
              "code": "// Token generation failed\n{\n  \"error\": \"internal_error\",\n  \"message\": \"Token generation failed\",\n  \"code\": \"INTERNAL_SERVER_ERROR\"\n}"
            },
            {
              "label": "serviceError",
              "code": "// Upstream service error\n{\n  \"error\": \"internal_error\",\n  \"message\": \"Failed to communicate with authentication backend\",\n  \"code\": \"INTERNAL_SERVER_ERROR\"\n}"
            }
          ]
        }
      ],
      "selectedLanguageId": "RcHUaMt4VJOHxzBlvXHod"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}