Create saved search
curl --request POST \
--url https://app.tryspecter.com/api/v1/searches \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"query_id": 4242,
"name": "German fintech"
}
'import requests
url = "https://app.tryspecter.com/api/v1/searches"
payload = {
"query_id": 4242,
"name": "German fintech"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({query_id: 4242, name: 'German fintech'})
};
fetch('https://app.tryspecter.com/api/v1/searches', 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://app.tryspecter.com/api/v1/searches",
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([
'query_id' => 4242,
'name' => 'German fintech'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://app.tryspecter.com/api/v1/searches"
payload := strings.NewReader("{\n \"query_id\": 4242,\n \"name\": \"German fintech\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://app.tryspecter.com/api/v1/searches")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query_id\": 4242,\n \"name\": \"German fintech\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tryspecter.com/api/v1/searches")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query_id\": 4242,\n \"name\": \"German fintech\"\n}"
response = http.request(request)
puts response.read_body{
"id": 41966,
"name": "German fintech",
"query_id": 4242,
"product_type": "company",
"owner_id": "user_2abcDEF456"
}{
"errorCode": "API_KEY_MISSING",
"message": "No API Key was presented on the header X-API-KEY"
}{
"errorCode": "NOT_PERMITTED",
"message": "You do not have permission to access this resource."
}{
"errorCode": "<string>",
"message": "<string>"
}Saved Searches
Create saved search
Saves an existing query under a name so its results can be read later.
Free. This call does not consume credits.
What you need
A query_id, which AI search returns for every query it resolves, and a name.
Behaviour
- The product is taken from the saved query, not the request, so a saved search and its filters cannot disagree about which product they describe. Sending a
product_typeis rejected with422. - The search is shared with the API and with your organization on creation, so it appears in Get all saved searches immediately and is visible to your team in the app.
- The search is assigned to an admin of your organization, returned as
owner_id. You do not choose the owner: only an admin-owned search can be deleted through the API, so any other owner would leave a search you cannot remove. An organization with no admin gets a422. - A name the owner has already used returns
409. - An unknown
query_idreturns404.
What you do next
- Read the results. Take the returned
idand call the matching product’s results endpoint. - Remove it. Delete it with Delete search.
POST
/
searches
Create saved search
curl --request POST \
--url https://app.tryspecter.com/api/v1/searches \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"query_id": 4242,
"name": "German fintech"
}
'import requests
url = "https://app.tryspecter.com/api/v1/searches"
payload = {
"query_id": 4242,
"name": "German fintech"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({query_id: 4242, name: 'German fintech'})
};
fetch('https://app.tryspecter.com/api/v1/searches', 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://app.tryspecter.com/api/v1/searches",
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([
'query_id' => 4242,
'name' => 'German fintech'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://app.tryspecter.com/api/v1/searches"
payload := strings.NewReader("{\n \"query_id\": 4242,\n \"name\": \"German fintech\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://app.tryspecter.com/api/v1/searches")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query_id\": 4242,\n \"name\": \"German fintech\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tryspecter.com/api/v1/searches")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query_id\": 4242,\n \"name\": \"German fintech\"\n}"
response = http.request(request)
puts response.read_body{
"id": 41966,
"name": "German fintech",
"query_id": 4242,
"product_type": "company",
"owner_id": "user_2abcDEF456"
}{
"errorCode": "API_KEY_MISSING",
"message": "No API Key was presented on the header X-API-KEY"
}{
"errorCode": "NOT_PERMITTED",
"message": "You do not have permission to access this resource."
}{
"errorCode": "<string>",
"message": "<string>"
}Authorizations
Body
application/json
Response
The saved search that was created.
Id of the saved search, for the read endpoints.
Example:
41966
Example:
"German fintech"
Example:
4242
Product the saved query searches.
Example:
"company"
Id of the organization admin the search was assigned to.
Example:
"user_2abcDEF456"
Was this page helpful?