POST
/
v1
/
auth
/
refresh
Refresh tokens
curl --request POST \
  --url https://api.next.orenda.finance/v1/auth/refresh \
  --header 'Content-Type: application/json' \
  --header 'x-program-id: <x-program-id>' \
  --data '
{
  "refresh_token": "eyJjdHkiOi...JWT...refresh...redacted"
}
'
import requests

url = "https://api.next.orenda.finance/v1/auth/refresh"

payload = { "refresh_token": "eyJjdHkiOi...JWT...refresh...redacted" }
headers = {
"x-program-id": "<x-program-id>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'x-program-id': '<x-program-id>', 'Content-Type': 'application/json'},
body: JSON.stringify({refresh_token: 'eyJjdHkiOi...JWT...refresh...redacted'})
};

fetch('https://api.next.orenda.finance/v1/auth/refresh', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.next.orenda.finance/v1/auth/refresh",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'refresh_token' => 'eyJjdHkiOi...JWT...refresh...redacted'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-program-id: <x-program-id>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.next.orenda.finance/v1/auth/refresh"

payload := strings.NewReader("{\n \"refresh_token\": \"eyJjdHkiOi...JWT...refresh...redacted\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-program-id", "<x-program-id>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.next.orenda.finance/v1/auth/refresh")
.header("x-program-id", "<x-program-id>")
.header("Content-Type", "application/json")
.body("{\n \"refresh_token\": \"eyJjdHkiOi...JWT...refresh...redacted\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.next.orenda.finance/v1/auth/refresh")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-program-id"] = '<x-program-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"refresh_token\": \"eyJjdHkiOi...JWT...refresh...redacted\"\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "data": {
    "authenticated": true,
    "access_token": "eyJhbGciOi...JWT...access...redacted",
    "id_token": "eyJhbGciOi...JWT...id...redacted",
    "refresh_token": "eyJjdHkiOi...JWT...refresh...redacted",
    "token_type": "Bearer",
    "expires_in": 3600,
    "hasPasskey": true,
    "hasMfa": true
  }
}
{
"success": false,
"code": "INVALID_CREDENTIALS",
"message": "<string>",
"retryable": true
}
{
"success": false,
"code": "INVALID_CREDENTIALS",
"message": "<string>",
"retryable": true
}
{
"success": false,
"code": "VALIDATION_ERROR",
"message": "email is required"
}
When the access token is about to expire (or a call returns 401), exchange the refresh_token for a fresh access_token and id_token. The lifetimes shape your client’s refresh loop:
TokenLifetimeWhat it means for you
access_token / id_token~5 minutes (expires_in)Refresh proactively just before expiry, or reactively on a 401. The same applies to the id_token before a WebSocket reconnect.
refresh_token~1 hourWhen it expires, refreshing stops working — send the user through sign-in again.
A login returns these tokens:
FieldWhat it’s for
access_tokenSend it as Authorization: Bearer <access_token> on every protected call.
id_tokenA JWT with the user’s details.
refresh_tokenUse it here to get a new access token.
expires_inHow long the access token lasts, in seconds.
hasPasskey / hasMfaWhether the user has a passkey or 2FA set up.
Keep using the same refresh token. Refreshing doesn’t give you a new one; the response returns your existing refresh_token unchanged, so store it once and reuse it.

Headers

x-program-id
string
required

Identifies the program. Can also be sent as the programId query parameter.

Body

application/json
refresh_token
string
required

Response

Tokens

success
boolean
Example:

true

data
object

Returned when login is fully complete.