curl --request POST \
--url https://api.writesonic.com/v2/geo/reports/sentiments \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"project_id": "550e8400-e29b-41d4-a716-446655440000",
"dimensions": [
"topic",
"model"
],
"start_date": "2026-01-01T00:00:00Z",
"end_date": "2026-01-31T23:59:59Z",
"current_from": "2023-11-07T05:31:56Z",
"current_to": "2023-11-07T05:31:56Z",
"comparison_start_date": "2026-07-25T00:00:00Z",
"comparison_end_date": "2026-07-31T23:59:59Z",
"previous_from": "2023-11-07T05:31:56Z",
"previous_to": "2023-11-07T05:31:56Z",
"order_by": [
{
"field": "visibility_score",
"order": "desc"
}
],
"pagination": {
"limit": 10,
"offset": 0
},
"measures": [
"total_keyword_occurrences",
"unique_positive_keywords"
],
"filters": {
"topics": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "550e8400-e29b-41d4-a716-446655440000"
},
{
"operator": "contains",
"value": "SEO"
}
]
},
"prompts": {
"condition": "AND",
"items": [
{
"operator": "contains",
"value": "best AI tools"
}
]
},
"tags": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "550e8400-e29b-41d4-a716-446655440000"
}
]
},
"markets": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "United States"
},
{
"operator": "is",
"value": "United Kingdom"
}
]
},
"intent": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "informational"
},
{
"operator": "is",
"value": "commercial"
}
]
},
"branded": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": false
}
]
},
"platform": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "ChatGPT"
},
{
"operator": "is",
"value": "Perplexity"
}
]
},
"has_shopping_card": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": true
}
]
},
"has_ads_data": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": true
}
]
},
"visibility": {
"condition": "AND",
"items": [
{
"operator": "gte",
"value": 50
}
]
},
"rank": {
"condition": "AND",
"items": [
{
"operator": "lte",
"value": 3
}
]
},
"website_mentioned_in_answer": {
"condition": "AND",
"items": [
{
"operator": "contains",
"value": "writesonic.com"
}
]
},
"cited_page_url": {
"condition": "AND",
"items": [
{
"operator": "contains",
"value": "/blog/"
}
]
},
"cited_domain": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": "writesonic.com"
}
]
},
"website_mentioned_in_citation": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": "550e8400-e29b-41d4-a716-446655440000"
}
]
},
"advanced_filters": {
"conditions": [
{
"field": "topics",
"operator": "is",
"value": "<topic-id>"
},
{
"field": "platform",
"operator": "is",
"value": "Grok"
}
],
"join": "or"
},
"status": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": "ACTIVE"
}
]
}
},
"date_aggregation_interval": "week",
"website_type": "SELF"
}
'import requests
url = "https://api.writesonic.com/v2/geo/reports/sentiments"
payload = {
"project_id": "550e8400-e29b-41d4-a716-446655440000",
"dimensions": ["topic", "model"],
"start_date": "2026-01-01T00:00:00Z",
"end_date": "2026-01-31T23:59:59Z",
"current_from": "2023-11-07T05:31:56Z",
"current_to": "2023-11-07T05:31:56Z",
"comparison_start_date": "2026-07-25T00:00:00Z",
"comparison_end_date": "2026-07-31T23:59:59Z",
"previous_from": "2023-11-07T05:31:56Z",
"previous_to": "2023-11-07T05:31:56Z",
"order_by": [
{
"field": "visibility_score",
"order": "desc"
}
],
"pagination": {
"limit": 10,
"offset": 0
},
"measures": ["total_keyword_occurrences", "unique_positive_keywords"],
"filters": {
"topics": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "550e8400-e29b-41d4-a716-446655440000"
},
{
"operator": "contains",
"value": "SEO"
}
]
},
"prompts": {
"condition": "AND",
"items": [
{
"operator": "contains",
"value": "best AI tools"
}
]
},
"tags": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "550e8400-e29b-41d4-a716-446655440000"
}
]
},
"markets": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "United States"
},
{
"operator": "is",
"value": "United Kingdom"
}
]
},
"intent": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "informational"
},
{
"operator": "is",
"value": "commercial"
}
]
},
"branded": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": False
}
]
},
"platform": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "ChatGPT"
},
{
"operator": "is",
"value": "Perplexity"
}
]
},
"has_shopping_card": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": True
}
]
},
"has_ads_data": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": True
}
]
},
"visibility": {
"condition": "AND",
"items": [
{
"operator": "gte",
"value": 50
}
]
},
"rank": {
"condition": "AND",
"items": [
{
"operator": "lte",
"value": 3
}
]
},
"website_mentioned_in_answer": {
"condition": "AND",
"items": [
{
"operator": "contains",
"value": "writesonic.com"
}
]
},
"cited_page_url": {
"condition": "AND",
"items": [
{
"operator": "contains",
"value": "/blog/"
}
]
},
"cited_domain": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": "writesonic.com"
}
]
},
"website_mentioned_in_citation": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": "550e8400-e29b-41d4-a716-446655440000"
}
]
},
"advanced_filters": {
"conditions": [
{
"field": "topics",
"operator": "is",
"value": "<topic-id>"
},
{
"field": "platform",
"operator": "is",
"value": "Grok"
}
],
"join": "or"
},
"status": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": "ACTIVE"
}
]
}
},
"date_aggregation_interval": "week",
"website_type": "SELF"
}
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({
project_id: '550e8400-e29b-41d4-a716-446655440000',
dimensions: ['topic', 'model'],
start_date: '2026-01-01T00:00:00Z',
end_date: '2026-01-31T23:59:59Z',
current_from: '2023-11-07T05:31:56Z',
current_to: '2023-11-07T05:31:56Z',
comparison_start_date: '2026-07-25T00:00:00Z',
comparison_end_date: '2026-07-31T23:59:59Z',
previous_from: '2023-11-07T05:31:56Z',
previous_to: '2023-11-07T05:31:56Z',
order_by: [{field: 'visibility_score', order: 'desc'}],
pagination: {limit: 10, offset: 0},
measures: ['total_keyword_occurrences', 'unique_positive_keywords'],
filters: {
topics: {
condition: 'OR',
items: [
{operator: 'is', value: '550e8400-e29b-41d4-a716-446655440000'},
{operator: 'contains', value: 'SEO'}
]
},
prompts: {condition: 'AND', items: [{operator: 'contains', value: 'best AI tools'}]},
tags: {
condition: 'OR',
items: [{operator: 'is', value: '550e8400-e29b-41d4-a716-446655440000'}]
},
markets: {
condition: 'OR',
items: [
{operator: 'is', value: 'United States'},
{operator: 'is', value: 'United Kingdom'}
]
},
intent: {
condition: 'OR',
items: [
{operator: 'is', value: 'informational'},
{operator: 'is', value: 'commercial'}
]
},
branded: {condition: 'AND', items: [{operator: 'is', value: false}]},
platform: {
condition: 'OR',
items: [{operator: 'is', value: 'ChatGPT'}, {operator: 'is', value: 'Perplexity'}]
},
has_shopping_card: {condition: 'AND', items: [{operator: 'is', value: true}]},
has_ads_data: {condition: 'AND', items: [{operator: 'is', value: true}]},
visibility: {condition: 'AND', items: [{operator: 'gte', value: 50}]},
rank: {condition: 'AND', items: [{operator: 'lte', value: 3}]},
website_mentioned_in_answer: {condition: 'AND', items: [{operator: 'contains', value: 'writesonic.com'}]},
cited_page_url: {condition: 'AND', items: [{operator: 'contains', value: '/blog/'}]},
cited_domain: {condition: 'AND', items: [{operator: 'is', value: 'writesonic.com'}]},
website_mentioned_in_citation: {
condition: 'AND',
items: [{operator: 'is', value: '550e8400-e29b-41d4-a716-446655440000'}]
},
advanced_filters: {
conditions: [
{field: 'topics', operator: 'is', value: '<topic-id>'},
{field: 'platform', operator: 'is', value: 'Grok'}
],
join: 'or'
},
status: {condition: 'AND', items: [{operator: 'is', value: 'ACTIVE'}]}
},
date_aggregation_interval: 'week',
website_type: 'SELF'
})
};
fetch('https://api.writesonic.com/v2/geo/reports/sentiments', 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://api.writesonic.com/v2/geo/reports/sentiments",
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([
'project_id' => '550e8400-e29b-41d4-a716-446655440000',
'dimensions' => [
'topic',
'model'
],
'start_date' => '2026-01-01T00:00:00Z',
'end_date' => '2026-01-31T23:59:59Z',
'current_from' => '2023-11-07T05:31:56Z',
'current_to' => '2023-11-07T05:31:56Z',
'comparison_start_date' => '2026-07-25T00:00:00Z',
'comparison_end_date' => '2026-07-31T23:59:59Z',
'previous_from' => '2023-11-07T05:31:56Z',
'previous_to' => '2023-11-07T05:31:56Z',
'order_by' => [
[
'field' => 'visibility_score',
'order' => 'desc'
]
],
'pagination' => [
'limit' => 10,
'offset' => 0
],
'measures' => [
'total_keyword_occurrences',
'unique_positive_keywords'
],
'filters' => [
'topics' => [
'condition' => 'OR',
'items' => [
[
'operator' => 'is',
'value' => '550e8400-e29b-41d4-a716-446655440000'
],
[
'operator' => 'contains',
'value' => 'SEO'
]
]
],
'prompts' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'contains',
'value' => 'best AI tools'
]
]
],
'tags' => [
'condition' => 'OR',
'items' => [
[
'operator' => 'is',
'value' => '550e8400-e29b-41d4-a716-446655440000'
]
]
],
'markets' => [
'condition' => 'OR',
'items' => [
[
'operator' => 'is',
'value' => 'United States'
],
[
'operator' => 'is',
'value' => 'United Kingdom'
]
]
],
'intent' => [
'condition' => 'OR',
'items' => [
[
'operator' => 'is',
'value' => 'informational'
],
[
'operator' => 'is',
'value' => 'commercial'
]
]
],
'branded' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'is',
'value' => false
]
]
],
'platform' => [
'condition' => 'OR',
'items' => [
[
'operator' => 'is',
'value' => 'ChatGPT'
],
[
'operator' => 'is',
'value' => 'Perplexity'
]
]
],
'has_shopping_card' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'is',
'value' => true
]
]
],
'has_ads_data' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'is',
'value' => true
]
]
],
'visibility' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'gte',
'value' => 50
]
]
],
'rank' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'lte',
'value' => 3
]
]
],
'website_mentioned_in_answer' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'contains',
'value' => 'writesonic.com'
]
]
],
'cited_page_url' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'contains',
'value' => '/blog/'
]
]
],
'cited_domain' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'is',
'value' => 'writesonic.com'
]
]
],
'website_mentioned_in_citation' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'is',
'value' => '550e8400-e29b-41d4-a716-446655440000'
]
]
],
'advanced_filters' => [
'conditions' => [
[
'field' => 'topics',
'operator' => 'is',
'value' => '<topic-id>'
],
[
'field' => 'platform',
'operator' => 'is',
'value' => 'Grok'
]
],
'join' => 'or'
],
'status' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'is',
'value' => 'ACTIVE'
]
]
]
],
'date_aggregation_interval' => 'week',
'website_type' => 'SELF'
]),
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://api.writesonic.com/v2/geo/reports/sentiments"
payload := strings.NewReader("{\n \"project_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"dimensions\": [\n \"topic\",\n \"model\"\n ],\n \"start_date\": \"2026-01-01T00:00:00Z\",\n \"end_date\": \"2026-01-31T23:59:59Z\",\n \"current_from\": \"2023-11-07T05:31:56Z\",\n \"current_to\": \"2023-11-07T05:31:56Z\",\n \"comparison_start_date\": \"2026-07-25T00:00:00Z\",\n \"comparison_end_date\": \"2026-07-31T23:59:59Z\",\n \"previous_from\": \"2023-11-07T05:31:56Z\",\n \"previous_to\": \"2023-11-07T05:31:56Z\",\n \"order_by\": [\n {\n \"field\": \"visibility_score\",\n \"order\": \"desc\"\n }\n ],\n \"pagination\": {\n \"limit\": 10,\n \"offset\": 0\n },\n \"measures\": [\n \"total_keyword_occurrences\",\n \"unique_positive_keywords\"\n ],\n \"filters\": {\n \"topics\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n },\n {\n \"operator\": \"contains\",\n \"value\": \"SEO\"\n }\n ]\n },\n \"prompts\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"best AI tools\"\n }\n ]\n },\n \"tags\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n }\n ]\n },\n \"markets\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"United States\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"United Kingdom\"\n }\n ]\n },\n \"intent\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"informational\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"commercial\"\n }\n ]\n },\n \"branded\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": false\n }\n ]\n },\n \"platform\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"ChatGPT\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"Perplexity\"\n }\n ]\n },\n \"has_shopping_card\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": true\n }\n ]\n },\n \"has_ads_data\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": true\n }\n ]\n },\n \"visibility\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"gte\",\n \"value\": 50\n }\n ]\n },\n \"rank\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"lte\",\n \"value\": 3\n }\n ]\n },\n \"website_mentioned_in_answer\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"writesonic.com\"\n }\n ]\n },\n \"cited_page_url\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"/blog/\"\n }\n ]\n },\n \"cited_domain\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"writesonic.com\"\n }\n ]\n },\n \"website_mentioned_in_citation\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n }\n ]\n },\n \"advanced_filters\": {\n \"conditions\": [\n {\n \"field\": \"topics\",\n \"operator\": \"is\",\n \"value\": \"<topic-id>\"\n },\n {\n \"field\": \"platform\",\n \"operator\": \"is\",\n \"value\": \"Grok\"\n }\n ],\n \"join\": \"or\"\n },\n \"status\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"ACTIVE\"\n }\n ]\n }\n },\n \"date_aggregation_interval\": \"week\",\n \"website_type\": \"SELF\"\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://api.writesonic.com/v2/geo/reports/sentiments")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"dimensions\": [\n \"topic\",\n \"model\"\n ],\n \"start_date\": \"2026-01-01T00:00:00Z\",\n \"end_date\": \"2026-01-31T23:59:59Z\",\n \"current_from\": \"2023-11-07T05:31:56Z\",\n \"current_to\": \"2023-11-07T05:31:56Z\",\n \"comparison_start_date\": \"2026-07-25T00:00:00Z\",\n \"comparison_end_date\": \"2026-07-31T23:59:59Z\",\n \"previous_from\": \"2023-11-07T05:31:56Z\",\n \"previous_to\": \"2023-11-07T05:31:56Z\",\n \"order_by\": [\n {\n \"field\": \"visibility_score\",\n \"order\": \"desc\"\n }\n ],\n \"pagination\": {\n \"limit\": 10,\n \"offset\": 0\n },\n \"measures\": [\n \"total_keyword_occurrences\",\n \"unique_positive_keywords\"\n ],\n \"filters\": {\n \"topics\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n },\n {\n \"operator\": \"contains\",\n \"value\": \"SEO\"\n }\n ]\n },\n \"prompts\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"best AI tools\"\n }\n ]\n },\n \"tags\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n }\n ]\n },\n \"markets\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"United States\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"United Kingdom\"\n }\n ]\n },\n \"intent\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"informational\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"commercial\"\n }\n ]\n },\n \"branded\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": false\n }\n ]\n },\n \"platform\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"ChatGPT\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"Perplexity\"\n }\n ]\n },\n \"has_shopping_card\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": true\n }\n ]\n },\n \"has_ads_data\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": true\n }\n ]\n },\n \"visibility\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"gte\",\n \"value\": 50\n }\n ]\n },\n \"rank\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"lte\",\n \"value\": 3\n }\n ]\n },\n \"website_mentioned_in_answer\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"writesonic.com\"\n }\n ]\n },\n \"cited_page_url\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"/blog/\"\n }\n ]\n },\n \"cited_domain\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"writesonic.com\"\n }\n ]\n },\n \"website_mentioned_in_citation\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n }\n ]\n },\n \"advanced_filters\": {\n \"conditions\": [\n {\n \"field\": \"topics\",\n \"operator\": \"is\",\n \"value\": \"<topic-id>\"\n },\n {\n \"field\": \"platform\",\n \"operator\": \"is\",\n \"value\": \"Grok\"\n }\n ],\n \"join\": \"or\"\n },\n \"status\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"ACTIVE\"\n }\n ]\n }\n },\n \"date_aggregation_interval\": \"week\",\n \"website_type\": \"SELF\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.writesonic.com/v2/geo/reports/sentiments")
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 \"project_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"dimensions\": [\n \"topic\",\n \"model\"\n ],\n \"start_date\": \"2026-01-01T00:00:00Z\",\n \"end_date\": \"2026-01-31T23:59:59Z\",\n \"current_from\": \"2023-11-07T05:31:56Z\",\n \"current_to\": \"2023-11-07T05:31:56Z\",\n \"comparison_start_date\": \"2026-07-25T00:00:00Z\",\n \"comparison_end_date\": \"2026-07-31T23:59:59Z\",\n \"previous_from\": \"2023-11-07T05:31:56Z\",\n \"previous_to\": \"2023-11-07T05:31:56Z\",\n \"order_by\": [\n {\n \"field\": \"visibility_score\",\n \"order\": \"desc\"\n }\n ],\n \"pagination\": {\n \"limit\": 10,\n \"offset\": 0\n },\n \"measures\": [\n \"total_keyword_occurrences\",\n \"unique_positive_keywords\"\n ],\n \"filters\": {\n \"topics\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n },\n {\n \"operator\": \"contains\",\n \"value\": \"SEO\"\n }\n ]\n },\n \"prompts\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"best AI tools\"\n }\n ]\n },\n \"tags\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n }\n ]\n },\n \"markets\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"United States\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"United Kingdom\"\n }\n ]\n },\n \"intent\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"informational\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"commercial\"\n }\n ]\n },\n \"branded\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": false\n }\n ]\n },\n \"platform\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"ChatGPT\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"Perplexity\"\n }\n ]\n },\n \"has_shopping_card\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": true\n }\n ]\n },\n \"has_ads_data\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": true\n }\n ]\n },\n \"visibility\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"gte\",\n \"value\": 50\n }\n ]\n },\n \"rank\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"lte\",\n \"value\": 3\n }\n ]\n },\n \"website_mentioned_in_answer\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"writesonic.com\"\n }\n ]\n },\n \"cited_page_url\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"/blog/\"\n }\n ]\n },\n \"cited_domain\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"writesonic.com\"\n }\n ]\n },\n \"website_mentioned_in_citation\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n }\n ]\n },\n \"advanced_filters\": {\n \"conditions\": [\n {\n \"field\": \"topics\",\n \"operator\": \"is\",\n \"value\": \"<topic-id>\"\n },\n {\n \"field\": \"platform\",\n \"operator\": \"is\",\n \"value\": \"Grok\"\n }\n ],\n \"join\": \"or\"\n },\n \"status\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"ACTIVE\"\n }\n ]\n }\n },\n \"date_aggregation_interval\": \"week\",\n \"website_type\": \"SELF\"\n}"
response = http.request(request)
puts response.read_body{
"info": {
"total_rows": 123,
"query": {
"metrics": [
"<string>"
],
"start_date": "2023-11-07T05:31:56Z",
"end_date": "2023-11-07T05:31:56Z",
"order_by": {},
"pagination": {},
"filters": {},
"comparison_start_date": "2023-11-07T05:31:56Z",
"comparison_end_date": "2023-11-07T05:31:56Z"
}
},
"data": [
{
"topic_id": "<string>",
"topic_name": "<string>",
"tag_id": "<string>",
"tag_name": "<string>",
"market_id": "<string>",
"market_name": "<string>",
"model_id": "<string>",
"model_name": "<string>",
"query_id": "<string>",
"query_name": "<string>",
"date": "<string>",
"website_id": "<string>",
"website_name": "<string>",
"shopping": true,
"ads": true,
"branded": true,
"total_keyword_occurrences": 123,
"total_positive_keyword_occurrences": 123,
"unique_positive_keywords": 123,
"total_unique_keywords": 123,
"positive_subtheme_count": 123,
"negative_subtheme_count": 123,
"previous_total_keyword_occurrences": 123,
"previous_total_positive_keyword_occurrences": 123,
"previous_unique_positive_keywords": 123,
"previous_total_unique_keywords": 123,
"previous_positive_subtheme_count": 123,
"previous_negative_subtheme_count": 123
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Get Sentiment Report
Keyword sentiment metrics grouped by one or more dimensions.
Example: “Show positive keyword trends by topic, broken down monthly.”
Dimensions (at least 1 required): topic, tag, market, model, query, date, website
datesupports optionaldate_aggregation_interval:day(default) |week|monthwebsiteauto-setswebsite_typetoSELF+COMPETITORS(default isSELF)
Measures (omit for all): total_keyword_occurrences, total_positive_keyword_occurrences, unique_positive_keywords, total_unique_keywords
Filters: topics, prompts, tags, markets, intent, branded, platform, has_shopping_card, visibility, rank, website_mentioned_in_answer, cited_page_url, cited_domain, website_mentioned_in_citation, status.
Sort fields: Any measure name, plus date, query_name, topic_name, market_name, model_name, website_name, tag_name.
Dates: If no dates provided, defaults to latest run date range. Provide start_date and end_date in ISO 8601 format to specify a custom range.
Comparison: Provide comparison_start_date and comparison_end_date (ISO 8601, both required together) to also compute every measure over a past range — each row then gains previous_<measure> fields calculated with identical dimensions, measures, and filters. Rows match across periods by dimension; with the date dimension, each current bucket matches the comparison bucket exactly (start_date - comparison_start_date) earlier, so use equal-length ranges (and bucket-aligned ones for week/month intervals) — buckets with no counterpart simply omit previous_* values.
Pagination: Use pagination (limit 1-100, default 10; offset for paging). Use order_by for sorting.
Response: Returns data array with info metadata containing total_rows (before pagination) and query (applied metrics, dates, sorting, pagination, filters).
curl --request POST \
--url https://api.writesonic.com/v2/geo/reports/sentiments \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"project_id": "550e8400-e29b-41d4-a716-446655440000",
"dimensions": [
"topic",
"model"
],
"start_date": "2026-01-01T00:00:00Z",
"end_date": "2026-01-31T23:59:59Z",
"current_from": "2023-11-07T05:31:56Z",
"current_to": "2023-11-07T05:31:56Z",
"comparison_start_date": "2026-07-25T00:00:00Z",
"comparison_end_date": "2026-07-31T23:59:59Z",
"previous_from": "2023-11-07T05:31:56Z",
"previous_to": "2023-11-07T05:31:56Z",
"order_by": [
{
"field": "visibility_score",
"order": "desc"
}
],
"pagination": {
"limit": 10,
"offset": 0
},
"measures": [
"total_keyword_occurrences",
"unique_positive_keywords"
],
"filters": {
"topics": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "550e8400-e29b-41d4-a716-446655440000"
},
{
"operator": "contains",
"value": "SEO"
}
]
},
"prompts": {
"condition": "AND",
"items": [
{
"operator": "contains",
"value": "best AI tools"
}
]
},
"tags": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "550e8400-e29b-41d4-a716-446655440000"
}
]
},
"markets": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "United States"
},
{
"operator": "is",
"value": "United Kingdom"
}
]
},
"intent": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "informational"
},
{
"operator": "is",
"value": "commercial"
}
]
},
"branded": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": false
}
]
},
"platform": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "ChatGPT"
},
{
"operator": "is",
"value": "Perplexity"
}
]
},
"has_shopping_card": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": true
}
]
},
"has_ads_data": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": true
}
]
},
"visibility": {
"condition": "AND",
"items": [
{
"operator": "gte",
"value": 50
}
]
},
"rank": {
"condition": "AND",
"items": [
{
"operator": "lte",
"value": 3
}
]
},
"website_mentioned_in_answer": {
"condition": "AND",
"items": [
{
"operator": "contains",
"value": "writesonic.com"
}
]
},
"cited_page_url": {
"condition": "AND",
"items": [
{
"operator": "contains",
"value": "/blog/"
}
]
},
"cited_domain": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": "writesonic.com"
}
]
},
"website_mentioned_in_citation": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": "550e8400-e29b-41d4-a716-446655440000"
}
]
},
"advanced_filters": {
"conditions": [
{
"field": "topics",
"operator": "is",
"value": "<topic-id>"
},
{
"field": "platform",
"operator": "is",
"value": "Grok"
}
],
"join": "or"
},
"status": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": "ACTIVE"
}
]
}
},
"date_aggregation_interval": "week",
"website_type": "SELF"
}
'import requests
url = "https://api.writesonic.com/v2/geo/reports/sentiments"
payload = {
"project_id": "550e8400-e29b-41d4-a716-446655440000",
"dimensions": ["topic", "model"],
"start_date": "2026-01-01T00:00:00Z",
"end_date": "2026-01-31T23:59:59Z",
"current_from": "2023-11-07T05:31:56Z",
"current_to": "2023-11-07T05:31:56Z",
"comparison_start_date": "2026-07-25T00:00:00Z",
"comparison_end_date": "2026-07-31T23:59:59Z",
"previous_from": "2023-11-07T05:31:56Z",
"previous_to": "2023-11-07T05:31:56Z",
"order_by": [
{
"field": "visibility_score",
"order": "desc"
}
],
"pagination": {
"limit": 10,
"offset": 0
},
"measures": ["total_keyword_occurrences", "unique_positive_keywords"],
"filters": {
"topics": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "550e8400-e29b-41d4-a716-446655440000"
},
{
"operator": "contains",
"value": "SEO"
}
]
},
"prompts": {
"condition": "AND",
"items": [
{
"operator": "contains",
"value": "best AI tools"
}
]
},
"tags": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "550e8400-e29b-41d4-a716-446655440000"
}
]
},
"markets": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "United States"
},
{
"operator": "is",
"value": "United Kingdom"
}
]
},
"intent": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "informational"
},
{
"operator": "is",
"value": "commercial"
}
]
},
"branded": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": False
}
]
},
"platform": {
"condition": "OR",
"items": [
{
"operator": "is",
"value": "ChatGPT"
},
{
"operator": "is",
"value": "Perplexity"
}
]
},
"has_shopping_card": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": True
}
]
},
"has_ads_data": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": True
}
]
},
"visibility": {
"condition": "AND",
"items": [
{
"operator": "gte",
"value": 50
}
]
},
"rank": {
"condition": "AND",
"items": [
{
"operator": "lte",
"value": 3
}
]
},
"website_mentioned_in_answer": {
"condition": "AND",
"items": [
{
"operator": "contains",
"value": "writesonic.com"
}
]
},
"cited_page_url": {
"condition": "AND",
"items": [
{
"operator": "contains",
"value": "/blog/"
}
]
},
"cited_domain": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": "writesonic.com"
}
]
},
"website_mentioned_in_citation": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": "550e8400-e29b-41d4-a716-446655440000"
}
]
},
"advanced_filters": {
"conditions": [
{
"field": "topics",
"operator": "is",
"value": "<topic-id>"
},
{
"field": "platform",
"operator": "is",
"value": "Grok"
}
],
"join": "or"
},
"status": {
"condition": "AND",
"items": [
{
"operator": "is",
"value": "ACTIVE"
}
]
}
},
"date_aggregation_interval": "week",
"website_type": "SELF"
}
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({
project_id: '550e8400-e29b-41d4-a716-446655440000',
dimensions: ['topic', 'model'],
start_date: '2026-01-01T00:00:00Z',
end_date: '2026-01-31T23:59:59Z',
current_from: '2023-11-07T05:31:56Z',
current_to: '2023-11-07T05:31:56Z',
comparison_start_date: '2026-07-25T00:00:00Z',
comparison_end_date: '2026-07-31T23:59:59Z',
previous_from: '2023-11-07T05:31:56Z',
previous_to: '2023-11-07T05:31:56Z',
order_by: [{field: 'visibility_score', order: 'desc'}],
pagination: {limit: 10, offset: 0},
measures: ['total_keyword_occurrences', 'unique_positive_keywords'],
filters: {
topics: {
condition: 'OR',
items: [
{operator: 'is', value: '550e8400-e29b-41d4-a716-446655440000'},
{operator: 'contains', value: 'SEO'}
]
},
prompts: {condition: 'AND', items: [{operator: 'contains', value: 'best AI tools'}]},
tags: {
condition: 'OR',
items: [{operator: 'is', value: '550e8400-e29b-41d4-a716-446655440000'}]
},
markets: {
condition: 'OR',
items: [
{operator: 'is', value: 'United States'},
{operator: 'is', value: 'United Kingdom'}
]
},
intent: {
condition: 'OR',
items: [
{operator: 'is', value: 'informational'},
{operator: 'is', value: 'commercial'}
]
},
branded: {condition: 'AND', items: [{operator: 'is', value: false}]},
platform: {
condition: 'OR',
items: [{operator: 'is', value: 'ChatGPT'}, {operator: 'is', value: 'Perplexity'}]
},
has_shopping_card: {condition: 'AND', items: [{operator: 'is', value: true}]},
has_ads_data: {condition: 'AND', items: [{operator: 'is', value: true}]},
visibility: {condition: 'AND', items: [{operator: 'gte', value: 50}]},
rank: {condition: 'AND', items: [{operator: 'lte', value: 3}]},
website_mentioned_in_answer: {condition: 'AND', items: [{operator: 'contains', value: 'writesonic.com'}]},
cited_page_url: {condition: 'AND', items: [{operator: 'contains', value: '/blog/'}]},
cited_domain: {condition: 'AND', items: [{operator: 'is', value: 'writesonic.com'}]},
website_mentioned_in_citation: {
condition: 'AND',
items: [{operator: 'is', value: '550e8400-e29b-41d4-a716-446655440000'}]
},
advanced_filters: {
conditions: [
{field: 'topics', operator: 'is', value: '<topic-id>'},
{field: 'platform', operator: 'is', value: 'Grok'}
],
join: 'or'
},
status: {condition: 'AND', items: [{operator: 'is', value: 'ACTIVE'}]}
},
date_aggregation_interval: 'week',
website_type: 'SELF'
})
};
fetch('https://api.writesonic.com/v2/geo/reports/sentiments', 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://api.writesonic.com/v2/geo/reports/sentiments",
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([
'project_id' => '550e8400-e29b-41d4-a716-446655440000',
'dimensions' => [
'topic',
'model'
],
'start_date' => '2026-01-01T00:00:00Z',
'end_date' => '2026-01-31T23:59:59Z',
'current_from' => '2023-11-07T05:31:56Z',
'current_to' => '2023-11-07T05:31:56Z',
'comparison_start_date' => '2026-07-25T00:00:00Z',
'comparison_end_date' => '2026-07-31T23:59:59Z',
'previous_from' => '2023-11-07T05:31:56Z',
'previous_to' => '2023-11-07T05:31:56Z',
'order_by' => [
[
'field' => 'visibility_score',
'order' => 'desc'
]
],
'pagination' => [
'limit' => 10,
'offset' => 0
],
'measures' => [
'total_keyword_occurrences',
'unique_positive_keywords'
],
'filters' => [
'topics' => [
'condition' => 'OR',
'items' => [
[
'operator' => 'is',
'value' => '550e8400-e29b-41d4-a716-446655440000'
],
[
'operator' => 'contains',
'value' => 'SEO'
]
]
],
'prompts' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'contains',
'value' => 'best AI tools'
]
]
],
'tags' => [
'condition' => 'OR',
'items' => [
[
'operator' => 'is',
'value' => '550e8400-e29b-41d4-a716-446655440000'
]
]
],
'markets' => [
'condition' => 'OR',
'items' => [
[
'operator' => 'is',
'value' => 'United States'
],
[
'operator' => 'is',
'value' => 'United Kingdom'
]
]
],
'intent' => [
'condition' => 'OR',
'items' => [
[
'operator' => 'is',
'value' => 'informational'
],
[
'operator' => 'is',
'value' => 'commercial'
]
]
],
'branded' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'is',
'value' => false
]
]
],
'platform' => [
'condition' => 'OR',
'items' => [
[
'operator' => 'is',
'value' => 'ChatGPT'
],
[
'operator' => 'is',
'value' => 'Perplexity'
]
]
],
'has_shopping_card' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'is',
'value' => true
]
]
],
'has_ads_data' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'is',
'value' => true
]
]
],
'visibility' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'gte',
'value' => 50
]
]
],
'rank' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'lte',
'value' => 3
]
]
],
'website_mentioned_in_answer' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'contains',
'value' => 'writesonic.com'
]
]
],
'cited_page_url' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'contains',
'value' => '/blog/'
]
]
],
'cited_domain' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'is',
'value' => 'writesonic.com'
]
]
],
'website_mentioned_in_citation' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'is',
'value' => '550e8400-e29b-41d4-a716-446655440000'
]
]
],
'advanced_filters' => [
'conditions' => [
[
'field' => 'topics',
'operator' => 'is',
'value' => '<topic-id>'
],
[
'field' => 'platform',
'operator' => 'is',
'value' => 'Grok'
]
],
'join' => 'or'
],
'status' => [
'condition' => 'AND',
'items' => [
[
'operator' => 'is',
'value' => 'ACTIVE'
]
]
]
],
'date_aggregation_interval' => 'week',
'website_type' => 'SELF'
]),
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://api.writesonic.com/v2/geo/reports/sentiments"
payload := strings.NewReader("{\n \"project_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"dimensions\": [\n \"topic\",\n \"model\"\n ],\n \"start_date\": \"2026-01-01T00:00:00Z\",\n \"end_date\": \"2026-01-31T23:59:59Z\",\n \"current_from\": \"2023-11-07T05:31:56Z\",\n \"current_to\": \"2023-11-07T05:31:56Z\",\n \"comparison_start_date\": \"2026-07-25T00:00:00Z\",\n \"comparison_end_date\": \"2026-07-31T23:59:59Z\",\n \"previous_from\": \"2023-11-07T05:31:56Z\",\n \"previous_to\": \"2023-11-07T05:31:56Z\",\n \"order_by\": [\n {\n \"field\": \"visibility_score\",\n \"order\": \"desc\"\n }\n ],\n \"pagination\": {\n \"limit\": 10,\n \"offset\": 0\n },\n \"measures\": [\n \"total_keyword_occurrences\",\n \"unique_positive_keywords\"\n ],\n \"filters\": {\n \"topics\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n },\n {\n \"operator\": \"contains\",\n \"value\": \"SEO\"\n }\n ]\n },\n \"prompts\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"best AI tools\"\n }\n ]\n },\n \"tags\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n }\n ]\n },\n \"markets\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"United States\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"United Kingdom\"\n }\n ]\n },\n \"intent\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"informational\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"commercial\"\n }\n ]\n },\n \"branded\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": false\n }\n ]\n },\n \"platform\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"ChatGPT\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"Perplexity\"\n }\n ]\n },\n \"has_shopping_card\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": true\n }\n ]\n },\n \"has_ads_data\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": true\n }\n ]\n },\n \"visibility\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"gte\",\n \"value\": 50\n }\n ]\n },\n \"rank\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"lte\",\n \"value\": 3\n }\n ]\n },\n \"website_mentioned_in_answer\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"writesonic.com\"\n }\n ]\n },\n \"cited_page_url\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"/blog/\"\n }\n ]\n },\n \"cited_domain\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"writesonic.com\"\n }\n ]\n },\n \"website_mentioned_in_citation\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n }\n ]\n },\n \"advanced_filters\": {\n \"conditions\": [\n {\n \"field\": \"topics\",\n \"operator\": \"is\",\n \"value\": \"<topic-id>\"\n },\n {\n \"field\": \"platform\",\n \"operator\": \"is\",\n \"value\": \"Grok\"\n }\n ],\n \"join\": \"or\"\n },\n \"status\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"ACTIVE\"\n }\n ]\n }\n },\n \"date_aggregation_interval\": \"week\",\n \"website_type\": \"SELF\"\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://api.writesonic.com/v2/geo/reports/sentiments")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"dimensions\": [\n \"topic\",\n \"model\"\n ],\n \"start_date\": \"2026-01-01T00:00:00Z\",\n \"end_date\": \"2026-01-31T23:59:59Z\",\n \"current_from\": \"2023-11-07T05:31:56Z\",\n \"current_to\": \"2023-11-07T05:31:56Z\",\n \"comparison_start_date\": \"2026-07-25T00:00:00Z\",\n \"comparison_end_date\": \"2026-07-31T23:59:59Z\",\n \"previous_from\": \"2023-11-07T05:31:56Z\",\n \"previous_to\": \"2023-11-07T05:31:56Z\",\n \"order_by\": [\n {\n \"field\": \"visibility_score\",\n \"order\": \"desc\"\n }\n ],\n \"pagination\": {\n \"limit\": 10,\n \"offset\": 0\n },\n \"measures\": [\n \"total_keyword_occurrences\",\n \"unique_positive_keywords\"\n ],\n \"filters\": {\n \"topics\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n },\n {\n \"operator\": \"contains\",\n \"value\": \"SEO\"\n }\n ]\n },\n \"prompts\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"best AI tools\"\n }\n ]\n },\n \"tags\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n }\n ]\n },\n \"markets\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"United States\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"United Kingdom\"\n }\n ]\n },\n \"intent\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"informational\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"commercial\"\n }\n ]\n },\n \"branded\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": false\n }\n ]\n },\n \"platform\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"ChatGPT\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"Perplexity\"\n }\n ]\n },\n \"has_shopping_card\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": true\n }\n ]\n },\n \"has_ads_data\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": true\n }\n ]\n },\n \"visibility\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"gte\",\n \"value\": 50\n }\n ]\n },\n \"rank\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"lte\",\n \"value\": 3\n }\n ]\n },\n \"website_mentioned_in_answer\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"writesonic.com\"\n }\n ]\n },\n \"cited_page_url\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"/blog/\"\n }\n ]\n },\n \"cited_domain\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"writesonic.com\"\n }\n ]\n },\n \"website_mentioned_in_citation\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n }\n ]\n },\n \"advanced_filters\": {\n \"conditions\": [\n {\n \"field\": \"topics\",\n \"operator\": \"is\",\n \"value\": \"<topic-id>\"\n },\n {\n \"field\": \"platform\",\n \"operator\": \"is\",\n \"value\": \"Grok\"\n }\n ],\n \"join\": \"or\"\n },\n \"status\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"ACTIVE\"\n }\n ]\n }\n },\n \"date_aggregation_interval\": \"week\",\n \"website_type\": \"SELF\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.writesonic.com/v2/geo/reports/sentiments")
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 \"project_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"dimensions\": [\n \"topic\",\n \"model\"\n ],\n \"start_date\": \"2026-01-01T00:00:00Z\",\n \"end_date\": \"2026-01-31T23:59:59Z\",\n \"current_from\": \"2023-11-07T05:31:56Z\",\n \"current_to\": \"2023-11-07T05:31:56Z\",\n \"comparison_start_date\": \"2026-07-25T00:00:00Z\",\n \"comparison_end_date\": \"2026-07-31T23:59:59Z\",\n \"previous_from\": \"2023-11-07T05:31:56Z\",\n \"previous_to\": \"2023-11-07T05:31:56Z\",\n \"order_by\": [\n {\n \"field\": \"visibility_score\",\n \"order\": \"desc\"\n }\n ],\n \"pagination\": {\n \"limit\": 10,\n \"offset\": 0\n },\n \"measures\": [\n \"total_keyword_occurrences\",\n \"unique_positive_keywords\"\n ],\n \"filters\": {\n \"topics\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n },\n {\n \"operator\": \"contains\",\n \"value\": \"SEO\"\n }\n ]\n },\n \"prompts\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"best AI tools\"\n }\n ]\n },\n \"tags\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n }\n ]\n },\n \"markets\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"United States\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"United Kingdom\"\n }\n ]\n },\n \"intent\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"informational\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"commercial\"\n }\n ]\n },\n \"branded\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": false\n }\n ]\n },\n \"platform\": {\n \"condition\": \"OR\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"ChatGPT\"\n },\n {\n \"operator\": \"is\",\n \"value\": \"Perplexity\"\n }\n ]\n },\n \"has_shopping_card\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": true\n }\n ]\n },\n \"has_ads_data\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": true\n }\n ]\n },\n \"visibility\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"gte\",\n \"value\": 50\n }\n ]\n },\n \"rank\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"lte\",\n \"value\": 3\n }\n ]\n },\n \"website_mentioned_in_answer\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"writesonic.com\"\n }\n ]\n },\n \"cited_page_url\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"contains\",\n \"value\": \"/blog/\"\n }\n ]\n },\n \"cited_domain\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"writesonic.com\"\n }\n ]\n },\n \"website_mentioned_in_citation\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"550e8400-e29b-41d4-a716-446655440000\"\n }\n ]\n },\n \"advanced_filters\": {\n \"conditions\": [\n {\n \"field\": \"topics\",\n \"operator\": \"is\",\n \"value\": \"<topic-id>\"\n },\n {\n \"field\": \"platform\",\n \"operator\": \"is\",\n \"value\": \"Grok\"\n }\n ],\n \"join\": \"or\"\n },\n \"status\": {\n \"condition\": \"AND\",\n \"items\": [\n {\n \"operator\": \"is\",\n \"value\": \"ACTIVE\"\n }\n ]\n }\n },\n \"date_aggregation_interval\": \"week\",\n \"website_type\": \"SELF\"\n}"
response = http.request(request)
puts response.read_body{
"info": {
"total_rows": 123,
"query": {
"metrics": [
"<string>"
],
"start_date": "2023-11-07T05:31:56Z",
"end_date": "2023-11-07T05:31:56Z",
"order_by": {},
"pagination": {},
"filters": {},
"comparison_start_date": "2023-11-07T05:31:56Z",
"comparison_end_date": "2023-11-07T05:31:56Z"
}
},
"data": [
{
"topic_id": "<string>",
"topic_name": "<string>",
"tag_id": "<string>",
"tag_name": "<string>",
"market_id": "<string>",
"market_name": "<string>",
"model_id": "<string>",
"model_name": "<string>",
"query_id": "<string>",
"query_name": "<string>",
"date": "<string>",
"website_id": "<string>",
"website_name": "<string>",
"shopping": true,
"ads": true,
"branded": true,
"total_keyword_occurrences": 123,
"total_positive_keyword_occurrences": 123,
"unique_positive_keywords": 123,
"total_unique_keywords": 123,
"positive_subtheme_count": 123,
"negative_subtheme_count": 123,
"previous_total_keyword_occurrences": 123,
"previous_total_positive_keyword_occurrences": 123,
"previous_unique_positive_keywords": 123,
"previous_total_unique_keywords": 123,
"previous_positive_subtheme_count": 123,
"previous_negative_subtheme_count": 123
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Body
Request parameters for the Sentiment Report API.
Unique identifier of the project to query. Get valid project IDs from get_all_projects.
1"550e8400-e29b-41d4-a716-446655440000"
Dimensions to group sentiment data by. At least one dimension is required.
1Dimensions to group report data by.
topic: Group by topic/categorytag: Group by tagmarket: Group by market/regionmodel: Group by AI model (e.g. ChatGPT, Perplexity)query: Group by individual query/promptdate: Group by date (requires date_aggregation_interval)website: Group by tracked websiteshopping: Group by whether the response has a shopping card (true/false)ads: Group by whether the response has sponsored/ad placements (true/false)branded: Group by whether the underlying query is branded (true/false)
topic, tag, market, model, query, date, website, shopping, ads, branded ["topic", "model"]
["market", "date"]
Start of the date range (ISO 8601). Limits results to data collected on or after this date. When omitted: defaults to the latest run's start date for metric queries, or earliest available date for list queries.
"2026-01-01T00:00:00Z"
"2026-03-01T00:00:00Z"
End of the date range (ISO 8601). Limits results to data collected on or before this date. When omitted: defaults to today. Date-only strings (no 'T') are extended to end of day.
"2026-01-31T23:59:59Z"
"2026-03-17T23:59:59Z"
Alias for start_date (analytics-tool date naming).
Alias for end_date (analytics-tool date naming).
Start of the comparison (past) date range (ISO 8601). Provide together with comparison_end_date to additionally compute every measure over this past range — each row then includes previous_ values calculated with identical dimensions, measures, and filters.
"2026-07-25T00:00:00Z"
End of the comparison (past) date range (ISO 8601). Required together with comparison_start_date. Date-only strings (no 'T') are extended to end of day, same as end_date.
"2026-07-31T23:59:59Z"
Alias for comparison_start_date (analytics-tool date naming).
Alias for comparison_end_date (analytics-tool date naming).
Sort results by one or more fields. Each entry specifies a field name and direction. Results are sorted by the first entry, then ties broken by subsequent entries.
Show child attributes
Show child attributes
[
{
"field": "visibility_score",
"order": "desc"
}
]
[
{ "field": "mention_count", "order": "desc" },
{ "field": "rank", "order": "asc" }
]
Control result pagination. Set limit for page size and offset to skip results. Omit to return all results (use with caution on large datasets).
Show child attributes
Show child attributes
{ "limit": 10, "offset": 0 }
{ "limit": 25, "offset": 50 }
Sentiment metrics to include. If empty, all measures are returned.
Sentiment metrics to include in the report.
total_keyword_occurrences: Total occurrences of tracked keywordstotal_positive_keyword_occurrences: Occurrences of positive sentiment keywordsunique_positive_keywords: Count of distinct positive keywords foundtotal_unique_keywords: Count of all distinct keywords foundpositive_subtheme_count: Count of subthemes classified as positive (majority-vote: positive keyword hits >= negative hits)negative_subtheme_count: Count of subthemes classified as negative (majority-vote: negative keyword hits > positive hits)
total_keyword_occurrences, total_positive_keyword_occurrences, unique_positive_keywords, total_unique_keywords, positive_subtheme_count, negative_subtheme_count [
"total_keyword_occurrences",
"unique_positive_keywords"
]
Narrow results by topics, markets, platforms, etc. All filters are optional and combine with AND logic.
Show child attributes
Show child attributes
Optional. When using the 'date' dimension, controls time-series bucket size. Defaults to 'day' if omitted. Options: day, week, month.
day, week, month "week"
"day"
Scope results by website ownership. 'SELF' = your brand only, 'SELF+COMPETITORS' = your brand plus competitors, 'ALL' = all citations without domain filtering.
SELF, SELF+COMPETITORS, ALL "SELF"
Response
Successful Response
Was this page helpful?