GrokAI API
Collections
Search collection
code examples curl location globoff 'https //api askgrok ai/collections/{cid}/search' \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{ "query" "" }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "query" "" }); var requestoptions = { method 'post', headers myheaders, body raw, redirect 'follow' }; fetch("https //api askgrok ai/collections/{cid}/search", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("https //api askgrok ai/collections/{cid}/search") https = net http new(url host, url port) https use ssl = true request = net http post new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request body = json dump({ "query" "" }) response = https request(request) puts response read body import requests import json url = "https //api askgrok ai/collections/{cid}/search" payload = json dumps({ "query" "" }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("post", url, headers=headers, data=payload) print(response text) responses \[ { "id" "a1b2c3d4e5", "filename" "document pdf", "pagenumber" 1, "pagetotal" 10, "imageurl" "https //api askgrok ai/storage/path/to/document page png", "documenturl" "https //api askgrok ai/storage/path/to/document pdf", "text" "the raw text for this document block", "score" 0 925 } ]// default error response { "code" 403, "message" "user does not have access to this resource", "status" "access denied", "data" {} }