# Refresh Access Token

<EndpointPage
  breadcrumbs={[
    { label: "REST APIs", href: "/rest-api/rest-api" },
    { label: "Common", href: "/rest-api/rest-api#common" },
    { label: "OAuth", href: "/rest-api/common/oauth" },
    { label: "Refresh Access Token" },
  ]}
  title="Refresh Access Token"
  method="POST"
  url="https://exchange.gemini.com/auth/token"
  description="The access token you receive will be relatively short-lived (default 24 hours). Once an access token has expired you can use your refresh token to generate a new access token. Refresh tokens never expire, however they are one-time use only — your request for a new access token will also return a new refresh token."
  example={{
    request: {
      method: "POST",
      url: "https://exchange.gemini.com/auth/token",
      headers: [],
      body: {
        client_id: "my_id",
        client_secret: "my_secret",
        refresh_token: "215c5a89-6df7-457b-ba0b-70695da8c91f",
        grant_type: "refresh_token",
      },
    },
  }}
  sections={[
    {
      heading: "Request Body",
      children: (
        <ParamList
          exampleCode={`{\n  "client_id": "my_id",\n  "client_secret": "my_secret",\n  "refresh_token": "215c5a89-6df7-457b-ba0b-70695da8c91f",\n  "grant_type": "refresh_token"\n}`}
          exampleLabel="Example request body"
          params={[
            {
              name: "client_id",
              type: "string",
              required: true,
              description: "Unique ID of your application.",
            },
            {
              name: "client_secret",
              type: "string",
              required: true,
              description: <>Secret of your application. This is provided when you first register an app in <a href="https://exchange.gemini.com/settings/api" style={{ color: "inherit", textDecorationLine: "underline" }}>API settings</a>.</>,
            },
            {
              name: "refresh_token",
              type: "string",
              required: true,
              description: "Your refresh token.",
            },
            {
              name: "grant_type",
              type: "string",
              required: true,
              description: 'The literal string "refresh_token".',
              example: "refresh_token",
            },
          ]}
        />
      ),
    },
    {
      heading: "Responses",
      children: (
        <ResponsesSection tabs={[
          {
            code: "200",
            description: "New access and refresh tokens successfully issued",
            params: [
              { name: "access_token", type: "string", description: "A short-lived token to use in API call authentication." },
              { name: "refresh_token", type: "string", description: "A new refresh token to be used to generate future access tokens." },
              { name: "token_type", type: "string", description: 'The literal string "Bearer".' },
              { name: "scope", type: "string", description: "The OAuth scopes the access token will have access to." },
              { name: "expires_in", type: "integer", description: "The lifetime in seconds of the access token, as measured from the current time." },
            ],
            example: `{\n  "access_token": "c5e9459d-dc6f-4567-bce4-050ec965f22e",\n  "expires_in": 86399,\n  "scope": "balances:read,orders:create",\n  "refresh_token": "ce0f14af-74dd-4767-a4e7-286e98b944c1",\n  "token_type": "Bearer"\n}`,
          },
          { code: "400", description: "Bad request - malformed request or invalid parameters", params: [{ name: "result", type: "string", description: "Error" }, { name: "reason", type: "string", description: "A short description" }, { name: "message", type: "string", description: "Detailed error message" }], example: `{\n  "result": "error",\n  "reason": "InvalidSignature",\n  "message": "Invalid signature for this request"\n}` },
          { code: "401", description: "Unauthorized - missing or invalid authentication", params: [{ name: "result", type: "string", description: "Error" }, { name: "reason", type: "string", description: "A short description" }, { name: "message", type: "string", description: "Detailed error message" }], example: `{\n  "result": "error",\n  "reason": "MissingApikeyHeader",\n  "message": "Must provide 'X-GEMINI-APIKEY' header"\n}` },
          { code: "403", description: "API key fails IP filtering check", params: [{ name: "result", type: "string", description: "Error" }, { name: "reason", type: "string", description: "A short description" }, { name: "message", type: "string", description: "Detailed error message" }], example: `{\n  "result": "error",\n  "reason": "ApiKeyIpFilteringFailure",\n  "message": "ApiKey fails IP Filtering Check for some accounts"\n}` },
          { code: "404", description: "Resource not found", params: [{ name: "result", type: "string", description: "Error" }, { name: "reason", type: "string", description: "A short description" }, { name: "message", type: "string", description: "Detailed error message" }], example: `{\n  "result": "error",\n  "reason": "EndpointNotFound",\n  "message": "API entry point not found"\n}` },
          { code: "429", description: "Too many requests - you have exceeded the rate limit", params: [{ name: "result", type: "string", description: "Error" }, { name: "reason", type: "string", description: "A short description" }, { name: "message", type: "string", description: "Detailed error message" }], example: `{\n  "result": "error",\n  "reason": "Too Many Requests",\n  "message": "Too Many Requests"\n}` },
          { code: "500", description: "Internal server error", params: [{ name: "result", type: "string", description: "Error" }, { name: "reason", type: "string", description: "A short description" }, { name: "message", type: "string", description: "Detailed error message" }], example: `{\n  "result": "error",\n  "reason": "Internal Server Error",\n  "message": "Unexpected server error occurred."\n}` },
        ]} />
      ),
    },
  ]}
/>

<PageNavigation
  prev={{ label: "Get Access Token", href: "/rest-api/common/oauth/authorization-token-request" }}
  next={{ label: "Revoke Access Token", href: "/rest-api/common/oauth/revoke-access-token" }}
/>
