Mini App Sessions
AI Tools
Open in ChatGPT
Open in ChatGPT to ask questions about this page
Open in Claude
Open in Claude to ask questions about this page
Copy as Markdown
Copy this page as markdown to use with AI assistants
View as Markdown
Open this page as markdown in a new tab
Open in ChatGPT
Open in ChatGPT to ask questions about this page
Open in Claude
Open in Claude to ask questions about this page
Copy as Markdown
Copy this page as markdown to use with AI assistants
View as Markdown
Open this page as markdown in a new tab
Mini apps are lightweight, web-based applications that run directly within Arattai, allowing customers to explore web services without leaving the chat window. Instead of redirecting users to external browsers or standalone apps, mini apps let businesses offer interactive, real-time experiences within the conversation itself.
Businesses use the Mini Apps API to access user data when a customer interacts with a mini app, and to close mini app sessions when they're no longer needed.
Hash Key
A hash key is a secure, one-time-use, time-sensitive key generated by Arattai Business Platform. It's passed as a URL query parameter (e.g. user_data_key) when a user interacts with a mini app, letting the business retrieve session details via the API without exposing sensitive data directly in the URL.
https://www.your-business-app.com?user_data_key=7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879
Businesses use this key to fetch user details without exposing personal identifiers such as phone numbers or internal IDs. The key is unique per interaction and time-sensitive. Consent for data collection is requested once per business, not per mini app. Once granted, consent remains valid for 60 days and auto-expires unless renewed.
Session Lifecycle
Fetching and closing a session use two distinct, sequentially-dependent handles. The fetch key (one-time, 1-minute TTL) is consumed by GET /miniappsessions/{id}. A successful GET atomically creates the close handle (24-hour TTL), which is consumed by DELETE /miniappsessions/{id}. The close handle does not exist until a successful GET call creates it.
Error Response Format
{"code": "error_code", "message": "A human-readable description of the error."}
Note: 404 Not Found responses return no response body for this module.
Fetch Mini App Session API
AI Tools
Open in ChatGPT
Open in ChatGPT to ask questions about this page
Open in Claude
Open in Claude to ask questions about this page
Copy as Markdown
Copy this page as markdown to use with AI assistants
View as Markdown
Open this page as markdown in a new tab
Open in ChatGPT
Open in ChatGPT to ask questions about this page
Open in Claude
Open in Claude to ask questions about this page
Copy as Markdown
Copy this page as markdown to use with AI assistants
View as Markdown
Open this page as markdown in a new tab
Retrieves customer session data when a customer interacts with a mini app, using the one-time hash key from the redirect URL. Consuming this fetch key atomically creates the close handle needed for the Close Mini App Session API - so this API must be called successfully before the session can be closed.
Rate Limits
- Threshold Limit (Number of API calls allowed within a minute) - 10 requests per minute, per session ID
- Lock Period (Wait time before consecutive API requests) - 10 minutes
OAuth Scope : ArattaiBusiness.customerdata.READ
Path Parameters
Query Parameters
true, the response includes an api_token field that can be used to send one free transactional template message when the user opens the mini app. If omitted or false, api_token is never included.headers_data = Map();
headers_data.put("Authorization", "Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://business.arattai.in/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879"
type: GET
headers: headers_data
connection: <connection_name>
];
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://business.arattai.in/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879")
.get()
.addHeader("Authorization", "Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'GET',
headers: {
Authorization: 'Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://business.arattai.in/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("business.arattai.in")
headers = { 'Authorization': "Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("GET", "/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "GET",
"hostname": "business.arattai.in",
"port": null,
"path": "/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879",
"headers": {
"Authorization": "Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
var client = new RestClient("https://business.arattai.in/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
IRestResponse response = client.Execute(request);
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("https://business.arattai.in/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879"),
Headers =
{
{ "Authorization", "Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://business.arattai.in/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://business.arattai.in/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879");
xhr.setRequestHeader("Authorization", "Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
xhr.send(data);
curl --request GET \
--url https://business.arattai.in/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879 \
--header 'Authorization: Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"url": "/api/v1/miniappsessions/7146101887a22ebcfaac",
"type": "miniapp_session",
"data": {
"id": "114627669",
"name": "Ryan West",
"phone": "91-9999999911",
"businessnumber_id": "182731000000067001",
"source": {
"type": "chat"
}
}
}
{
"url": "/api/v1/miniappsessions/7146101887a22ebcfaac",
"type": "miniapp_session",
"data": {
"id": "114627669",
"name": "Ryan West",
"phone": "91-9999999911",
"businessnumber_id": "182731000000067001",
"api_token": "2ef451beaff3ukfw8233f56fd22499749bc3e6d6d0a248e0e25ff20981dfsjdfwia6",
"source": {
"type": "template_message",
"template_id": "501000000008001"
}
}
}
{
"url": "/api/v1/miniappsessions/7146101887a22ebcfaac",
"type": "miniapp_session",
"data": {
"id": "114627669",
"name": "Ryan West",
"phone": "91-9999999911",
"businessnumber_id": "182731000000067001",
"custom_info": {
"order_id": "ORD-2026-0417"
},
"source": {
"type": "chat"
}
}
}
{
"code": "invalid_input",
"message": "Either the input stream or parameter is invalid or absent"
}
{
"code": "invalid_oauthtoken",
"message": "You are not authenticated to do this operation"
}
{
"code": "invalid_method",
"message": "Invalid method"
}
{
"code": "too_many_requests",
"message": "You have reached the maximum number of requests"
}
Close Mini App Session API
AI Tools
Open in ChatGPT
Open in ChatGPT to ask questions about this page
Open in Claude
Open in Claude to ask questions about this page
Copy as Markdown
Copy this page as markdown to use with AI assistants
View as Markdown
Open this page as markdown in a new tab
Open in ChatGPT
Open in ChatGPT to ask questions about this page
Open in Claude
Open in Claude to ask questions about this page
Copy as Markdown
Copy this page as markdown to use with AI assistants
View as Markdown
Open this page as markdown in a new tab
Ends a user's mini app session. Use the same session id that was passed to the Fetch Mini App Session API - closing only works if that API was called successfully first, since it's what creates the close handle this endpoint consumes.
Rate Limits
- Threshold Limit (Number of API calls allowed within a minute) - 10 requests per minute, per session ID
- Lock Period (Wait time before consecutive API requests) - 10 minutes
OAuth Scope : ArattaiBusiness.customerdata.DELETE
Path Parameters
id used in a prior, successful Fetch Mini App Session request. Valid for 24 hours after that call.headers_data = Map();
headers_data.put("Authorization", "Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://business.arattai.in/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879"
type: DELETE
headers: headers_data
connection: <connection_name>
];
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://business.arattai.in/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879")
.delete(null)
.addHeader("Authorization", "Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'DELETE',
headers: {
Authorization: 'Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://business.arattai.in/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("business.arattai.in")
headers = { 'Authorization': "Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("DELETE", "/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "DELETE",
"hostname": "business.arattai.in",
"port": null,
"path": "/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879",
"headers": {
"Authorization": "Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
var client = new RestClient("https://business.arattai.in/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
IRestResponse response = client.Execute(request);
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("https://business.arattai.in/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879"),
Headers =
{
{ "Authorization", "Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://business.arattai.in/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("DELETE", "https://business.arattai.in/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879");
xhr.setRequestHeader("Authorization", "Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
xhr.send(data);
curl --request DELETE \
--url https://business.arattai.in/api/v1/miniappsessions/7146101887a22ebcfaacfc56789ecafca5e57dfec08fe225af9f4c3ffa92879 \
--header 'Authorization: Bearer 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"code": "invalid_input",
"message": "Either the input stream or parameter is invalid or absent"
}
{
"code": "invalid_oauthtoken",
"message": "You are not authenticated to do this operation"
}
{
"code": "invalid_method",
"message": "Invalid method"
}
{
"code": "too_many_requests",
"message": "You have reached the maximum number of requests"
}