Refresh the session
Returns new tokens for an open session, up to 7 days after it was opened. Refreshing doesn’t count as user activity (see Operation OTP in the channel in the guide).
Authentication
Authorization: Bearer <channel token>, from POST /api/v1/channel/token. The user token is not accepted here.
Production
Available in test today. In production these calls go to https://partners-api.kravata.co with your mTLS client certificate; ask your Kravata point of contact before going live.
See the WhatsApp channel guide for the full flow.
Errors
| Status | Code | Meaning |
|---|---|---|
| 401 | SESSION_NOT_FOUND | No open channel session for this token. |
| 401 | SESSION_EXPIRED | More than 7 days, or revoked: verify the user again. |
curl --request POST \
--url https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/refresh \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"waId": "573001234567",
"refreshToken": "<string>"
}
'import requests
url = "https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/refresh"
payload = {
"waId": "573001234567",
"refreshToken": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({waId: '573001234567', refreshToken: '<string>'})
};
fetch('https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/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://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/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([
'waId' => '573001234567',
'refreshToken' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/refresh"
payload := strings.NewReader("{\n \"waId\": \"573001234567\",\n \"refreshToken\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/refresh")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"waId\": \"573001234567\",\n \"refreshToken\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/refresh")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"waId\": \"573001234567\",\n \"refreshToken\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"accessToken": "<string>",
"userId": "<string>",
"refreshToken": "<string>",
"expiresIn": 300,
"refreshExpiresIn": 123
}Authorizations
Access token from POST /api/v1/client/token.
Body
Response
Successful response
User token. Use it for every user call (PIN, deposit, accounts, withdrawal).
Kravata user id.
Use it with Refresh the session.
Validity of accessToken, in seconds.
300
Validity of refreshToken, in seconds.
curl --request POST \
--url https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/refresh \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"waId": "573001234567",
"refreshToken": "<string>"
}
'import requests
url = "https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/refresh"
payload = {
"waId": "573001234567",
"refreshToken": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({waId: '573001234567', refreshToken: '<string>'})
};
fetch('https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/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://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/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([
'waId' => '573001234567',
'refreshToken' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/refresh"
payload := strings.NewReader("{\n \"waId\": \"573001234567\",\n \"refreshToken\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/refresh")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"waId\": \"573001234567\",\n \"refreshToken\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://test-api-kore.kravata.co/api/v1/channel/whatsapp/session/refresh")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"waId\": \"573001234567\",\n \"refreshToken\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"accessToken": "<string>",
"userId": "<string>",
"refreshToken": "<string>",
"expiresIn": 300,
"refreshExpiresIn": 123
}
