> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.finput.com.au/api/endpoints/authentication/refresh-token/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.finput.com.au/_mcp/server. # Exchange a refresh token for a new token pair POST https://api.finput.com.au/api/v1/auth/refresh Content-Type: application/json Returns a **new access token and a new refresh token**. The refresh token you send is spent by this call. **A spent token still redeems for a short grace window** (currently 30 seconds), and returns **the same successor** the first refresh issued. After the window it is refused with `401`. So concurrent refreshes with one token all succeed with the same new refresh token, and a refresh whose response was lost can be retried promptly. The contract a client must implement: 1. On a `401` from another endpoint, refresh once and retry the original request once. A `401` from this endpoint, or from the retried request, ends the session. 2. Store the `refresh` from the response, replacing the one you sent. Concurrent refreshes return the same one, so the last response stored wins harmlessly. 3. Single-flighting refreshes is an optimisation, not a requirement. 4. `429` is a rate limit, not a sign-out: back off and retry. **Refreshing pushes back the idle timeout, never the hard cap.** The new refresh token expires one idle period from now, or at the cap counted from sign-in if that is sooner. The sign-in time is carried unchanged in every rotated token, and an access token never outlives its refresh token. Authentication is by the refresh token in the body, not by the `Authorization` header, so this endpoint takes no bearer token. Rate limited per user (not per IP), so colleagues sharing an office egress address do not share a budget. Reference: https://docs.finput.com.au/api/endpoints/authentication/refresh-token ## Request ### Body (application/json) This endpoint expects a RefreshRequest. - `refresh` (string, required) — The refresh token last issued to this client — either from login or from the previous refresh. ## Response ### 200 A fresh token pair. The token you sent is spent; inside the grace window it returns this same refresh token again. - `access` (string, optional) — A new access token. - `refresh` (string, optional) — The successor refresh token. **Replace your stored copy with this one.** It expires one idle period from now, or at the session's hard cap from sign-in if that is sooner. ## Errors ### 401 Unauthorized Error The refresh token is expired, revoked by logout, spent longer ago than the grace window, or invalid — or its user is inactive. The session is over: sign the user out. - `error` (string, optional) - `errors` (map from string to list of string, optional) ### 429 Too Many Requests Error Too many refreshes for this user. - `error` (string, optional) - `errors` (map from string to list of string, optional) ## Examples **Request** ```json { "refresh": "string" } ``` **Response** ```json { "access": "string", "refresh": "string" } ``` **SDK Code** ```python import requests url = "https://api.finput.com.au/api/v1/auth/refresh" payload = { "refresh": "string" } headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.finput.com.au/api/v1/auth/refresh'; const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"refresh":"string"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.finput.com.au/api/v1/auth/refresh" payload := strings.NewReader("{\n \"refresh\": \"string\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.finput.com.au/api/v1/auth/refresh") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{\n \"refresh\": \"string\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.finput.com.au/api/v1/auth/refresh") .header("Content-Type", "application/json") .body("{\n \"refresh\": \"string\"\n}") .asString(); ``` ```php request('POST', 'https://api.finput.com.au/api/v1/auth/refresh', [ 'body' => '{ "refresh": "string" }', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.finput.com.au/api/v1/auth/refresh"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"refresh\": \"string\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Content-Type": "application/json"] let parameters = ["refresh": "string"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.finput.com.au/api/v1/auth/refresh")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```