> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://documentation.sayari.com/api/api-reference/info/get-history/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://documentation.sayari.com/_mcp/server. # Get History GET https://api.sayari.com/v1/history The history endpoint return a user's event history. Reference: https://documentation.sayari.com/api/api-reference/info/get-history ## Authentication - OAuth2 — send the obtained token as `Authorization: Bearer ` ## Servers - `https://api.sayari.com` (Production, default) - `https://api.internal.sayari.com` (Dev) - `https://api.uk.sayari.com` (Production_UK) ## Request ### Query parameters - `events` (string, optional) — The type of events to filter on. - `from` (date, optional) — An ISO 8601 encoded date string indicating the starting time period for the events. In the format YYYY-MM-DD - `to` (date, optional) — An ISO 8601 encoded date string indicating the ending time period for the events. In the format YYYY-MM-DD - `size` (integer, optional) — Size to limit number of events returned - `token` (string, optional) — Pagination token to retrieve the next page of results ## Response ### 200 OK - `size` (integer, required) - `next_token` (string, required) - `events` (list of HistoryInfo, required) ## Errors ### 400 Bad Request - `any` ### 401 Unauthorized - `any` ### 404 Not Found - `status` (integer, required) - `message` (list of string, required) - `success` (boolean, required) ### 429 Rate Limit Exceeded - `any` ### 500 Internal Server Error - `any` ## Types ### HistoryInfo - `user` (string, required) - `environment` (string, required) - `event` (string, required) - `data` (map from string to any, required) — A map of fields appearing in the audit logs for this event - `timestamp` (string, required) ## Examples **Response** ```json { "size": 1, "next_token": "next_token", "events": [ { "user": "user", "environment": "environment", "event": "event", "data": { "data": { "key": "value" } }, "timestamp": "timestamp" }, { "user": "user", "environment": "environment", "event": "event", "data": { "data": { "key": "value" } }, "timestamp": "timestamp" } ] } ``` **SDK Code** ```python import requests url = "https://api.sayari.com/v1/history" headers = {"Authorization": "."} response = requests.get(url, headers=headers) print(response.json()) ``` ```typescript import { SayariClient } from "sayari"; const sayari = new SayariClient({ clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET" }); await sayari.info.getHistory({ events: "string", from: "2023-01-15", to: "2023-01-15", size: 1, token: "string" }); ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.sayari.com/v1/history" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", ".") 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.sayari.com/v1/history") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = '.' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.sayari.com/v1/history") .header("Authorization", ".") .asString(); ``` ```php request('GET', 'https://api.sayari.com/v1/history', [ 'headers' => [ 'Authorization' => '.', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.sayari.com/v1/history"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "."); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": "."] let request = NSMutableURLRequest(url: NSURL(string: "https://api.sayari.com/v1/history")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers 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() ```