News
Analyze story for persona
AI-powered analysis of how a persona perceives the news story. Uses credits.
POST
/
news
/
stories
/
{id}
/
analyze
cURL
curl -X POST "https://app.mavera.io/api/v1/news/stories/STORY_ID/analyze" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"persona_id": "your-persona-id"}'import requests
url = "https://app.mavera.io/api/v1/news/stories/{id}/analyze"
payload = { "persona_id": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({persona_id: '<string>'})
};
fetch('https://app.mavera.io/api/v1/news/stories/{id}/analyze', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.mavera.io/api/v1/news/stories/{id}/analyze"
payload := strings.NewReader("{\n \"persona_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"object": "news_story_analysis",
"story_id": "<string>",
"story_name": "<string>",
"persona": {
"id": "<string>",
"name": "<string>",
"category": "<string>"
},
"analysis": {
"quick_view": "<string>",
"emotional_response": "<string>",
"cognitive_engagement": "<string>",
"behavioral_intent": "<string>",
"news_contextualization": "<string>",
"risk_and_opportunity": "<string>",
"confidence": 123
},
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"credits_used": 123
},
"analyzed_at": "2023-11-07T05:31:56Z"
}{
"error": {
"message": "Invalid API key.",
"type": "authentication_error",
"code": "invalid_api_key",
"param": null
}
}{
"error": {
"message": "Insufficient credits. Please upgrade your subscription.",
"type": "insufficient_credits",
"code": "credits_exhausted",
"param": null
}
}{
"error": {
"message": "The requested resource was not found.",
"type": "not_found",
"code": "resource_not_found",
"param": null
}
}{
"error": {
"message": "Rate limit exceeded. Please retry after 30 seconds.",
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"param": null
}
}Authorizations
API key prefixed with mvra_live_. Create keys at Settings > Developer > API Keys.
Path Parameters
Story ID
Body
application/json
Persona ID to analyze the story for
⌘I
cURL
curl -X POST "https://app.mavera.io/api/v1/news/stories/STORY_ID/analyze" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"persona_id": "your-persona-id"}'import requests
url = "https://app.mavera.io/api/v1/news/stories/{id}/analyze"
payload = { "persona_id": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({persona_id: '<string>'})
};
fetch('https://app.mavera.io/api/v1/news/stories/{id}/analyze', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.mavera.io/api/v1/news/stories/{id}/analyze"
payload := strings.NewReader("{\n \"persona_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"object": "news_story_analysis",
"story_id": "<string>",
"story_name": "<string>",
"persona": {
"id": "<string>",
"name": "<string>",
"category": "<string>"
},
"analysis": {
"quick_view": "<string>",
"emotional_response": "<string>",
"cognitive_engagement": "<string>",
"behavioral_intent": "<string>",
"news_contextualization": "<string>",
"risk_and_opportunity": "<string>",
"confidence": 123
},
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"credits_used": 123
},
"analyzed_at": "2023-11-07T05:31:56Z"
}{
"error": {
"message": "Invalid API key.",
"type": "authentication_error",
"code": "invalid_api_key",
"param": null
}
}{
"error": {
"message": "Insufficient credits. Please upgrade your subscription.",
"type": "insufficient_credits",
"code": "credits_exhausted",
"param": null
}
}{
"error": {
"message": "The requested resource was not found.",
"type": "not_found",
"code": "resource_not_found",
"param": null
}
}{
"error": {
"message": "Rate limit exceeded. Please retry after 30 seconds.",
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"param": null
}
}