Quote or submit a Research job
Quote or run a Research job. Set quote_only: true to see the price without being charged, then send the same request with its quote_id to run it (costs at most 1 credit). Today this covers Facebook company ads by Page ID: one page, up to 30 results.
POST
/v1/research/jobsHeader parameters
Idempotency-KeystringrequiredA unique string that makes retries safe. Any value 16-255 characters; reuse it only when retrying the exact same request.
min length 16 · max length 255 · matches ^[A-Za-z0-9._:-]+$
X-RoasOS-ProjectstringOptional label to group this request under one of your projects. Appears in your usage records.
min length 1 · max length 64 · matches ^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$
X-RoasOS-Cost-CenterstringOptional label to attribute this request to a cost center. Appears in your usage records.
min length 1 · max length 64 · matches ^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$
Request body
requiredapplication/jsoncapability_idstringrequiredAllowed:
research.facebook-company-ads@1targetobjectrequiredShow propertiesHide properties
kindstringrequiredAllowed:
page_idpage_idstringrequiredmatches ^[1-9][0-9]{4,30}$
filtersobjectrequiredShow propertiesHide properties
countrystringmatches ^(?:ALL|[A-Z]{2})$
statusstringAllowed:
ACTIVEmedia_typestringAllowed:
ALLlanguagestringmatches ^[A-Z]{2}$
sort_bystringAllowed:
relevancy_monthly_groupedstart_datestringmatches ^\d{4}-\d{2}-\d{2}$
end_datestringmatches ^\d{4}-\d{2}-\d{2}$
pageobjectrequiredShow propertiesHide properties
max_pagesnumberrequiredAllowed:
1max_resultsintegerrequiredmin 1 · max 30
freshnessobjectrequiredShow propertiesHide properties
max_age_secondsintegerrequiredmin 0 · max 21600
allow_stalebooleanrequiredquote_onlybooleandefault: false
quote_idstring<uuid>Responses
200Immutable quote or free cache-hit job
Any of:
object
dataobjectrequiredShow propertiesHide properties
schema_versionstringrequiredAllowed:
research-quote@1kindstringrequiredAllowed:
research_quotestatusstringrequiredAllowed:
quotedquote_idstring<uuid>requiredcapability_idstringrequiredAllowed:
research.facebook-company-ads@1cache_dispositionstringrequiredAllowed:
cache_hitcache_joinlive_fetchcache_stalereserved_creditsintegerrequiredmin 0 · max 1000000000
maximum_creditsintegerrequiredmin 0 · max 1000000000
expires_atstring<date-time>requiredpricing_versionstringrequiredmin length 1 · max length 80
authorizationobjectrequiredShow propertiesHide properties
Any of:
object
statusstringrequiredAllowed:
auto_approvedobject
statusstringrequiredAllowed:
approval_requiredauthorize_urlstring<uri>requiredmax length 2048
confirmationobjectrequiredShow propertiesHide properties
max_pagesintegerrequiredmin 1 · max 3
max_resultsintegerrequiredmin 1 · max 100
max_age_secondsintegerrequiredmin 0 · max 2592000
allow_stalebooleanrequiredobject
dataobjectrequiredShow propertiesHide properties
Any of:
object
schema_versionstringrequiredAllowed:
research-job@1kindstringrequiredAllowed:
research_jobidstring<uuid>requiredcapability_idstringrequiredAllowed:
research.facebook-company-ads@1maximum_creditsintegerrequiredmin 0 · max 1000000000
created_atstring<date-time>requiredupdated_atstring<date-time>requiredstatusstringrequiredAllowed:
quotedcache_dispositionstringrequiredAllowed:
live_fetchreserved_creditsnumberrequiredAllowed:
0quote_idstring<uuid>requiredexpires_atstring<date-time>requiredobject
schema_versionstringrequiredAllowed:
research-job@1kindstringrequiredAllowed:
research_jobidstring<uuid>requiredcapability_idstringrequiredAllowed:
research.facebook-company-ads@1maximum_creditsintegerrequiredmin 0 · max 1000000000
created_atstring<date-time>requiredupdated_atstring<date-time>requiredstatusstringrequiredAllowed:
waiting_cachecache_dispositionstringrequiredAllowed:
cache_joinreserved_creditsnumberrequiredAllowed:
0object
schema_versionstringrequiredAllowed:
research-job@1kindstringrequiredAllowed:
research_jobidstring<uuid>requiredcapability_idstringrequiredAllowed:
research.facebook-company-ads@1maximum_creditsintegerrequiredmin 0 · max 1000000000
created_atstring<date-time>requiredupdated_atstring<date-time>requiredstatusstringrequiredAllowed:
queuedcache_dispositionstringrequiredAllowed:
live_fetchreserved_creditsintegerrequiredmin 0 · max 1000000000
object
schema_versionstringrequiredAllowed:
research-job@1kindstringrequiredAllowed:
research_jobidstring<uuid>requiredcapability_idstringrequiredAllowed:
research.facebook-company-ads@1maximum_creditsintegerrequiredmin 0 · max 1000000000
created_atstring<date-time>requiredupdated_atstring<date-time>requiredstatusstringrequiredAllowed:
processingcache_dispositionstringrequiredAllowed:
live_fetchreserved_creditsintegerrequiredmin 0 · max 1000000000
started_atstring<date-time>requiredobject
schema_versionstringrequiredAllowed:
research-job@1kindstringrequiredAllowed:
research_jobidstring<uuid>requiredcapability_idstringrequiredAllowed:
research.facebook-company-ads@1maximum_creditsintegerrequiredmin 0 · max 1000000000
created_atstring<date-time>requiredupdated_atstring<date-time>requiredstatusstringrequiredAllowed:
succeededcache_dispositionstringrequiredAllowed:
cache_hitcache_joinlive_fetchcache_stalereserved_creditsintegerrequiredmin 0 · max 1000000000
settled_creditsintegerrequiredmin 0 · max 1000000000
completed_atstring<date-time>requiredresult_readybooleanrequiredAllowed:
trueobject
schema_versionstringrequiredAllowed:
research-job@1kindstringrequiredAllowed:
research_jobidstring<uuid>requiredcapability_idstringrequiredAllowed:
research.facebook-company-ads@1maximum_creditsintegerrequiredmin 0 · max 1000000000
created_atstring<date-time>requiredupdated_atstring<date-time>requiredstatusstringrequiredAllowed:
failedcache_dispositionstringrequiredAllowed:
cache_joinlive_fetchreserved_creditsintegerrequiredmin 0 · max 1000000000
settled_creditsnumberrequiredAllowed:
0completed_atstring<date-time>requirederrorobjectrequiredShow propertiesHide properties
codestringrequiredAllowed:
research_failednormalization_failedmessagestringrequiredAllowed:
Research request failedResearch result could not be normalizedobject
schema_versionstringrequiredAllowed:
research-job@1kindstringrequiredAllowed:
research_jobidstring<uuid>requiredcapability_idstringrequiredAllowed:
research.facebook-company-ads@1maximum_creditsintegerrequiredmin 0 · max 1000000000
created_atstring<date-time>requiredupdated_atstring<date-time>requiredstatusstringrequiredAllowed:
unknowncache_dispositionstringrequiredAllowed:
cache_joinlive_fetchreserved_creditsintegerrequiredmin 0 · max 1000000000
reconciliation_requiredbooleanrequiredAllowed:
true202Durably queued live acquisition or free cache join
dataobjectrequiredShow propertiesHide properties
Any of:
object
schema_versionstringrequiredAllowed:
research-job@1kindstringrequiredAllowed:
research_jobidstring<uuid>requiredcapability_idstringrequiredAllowed:
research.facebook-company-ads@1maximum_creditsintegerrequiredmin 0 · max 1000000000
created_atstring<date-time>requiredupdated_atstring<date-time>requiredstatusstringrequiredAllowed:
quotedcache_dispositionstringrequiredAllowed:
live_fetchreserved_creditsnumberrequiredAllowed:
0quote_idstring<uuid>requiredexpires_atstring<date-time>requiredobject
schema_versionstringrequiredAllowed:
research-job@1kindstringrequiredAllowed:
research_jobidstring<uuid>requiredcapability_idstringrequiredAllowed:
research.facebook-company-ads@1maximum_creditsintegerrequiredmin 0 · max 1000000000
created_atstring<date-time>requiredupdated_atstring<date-time>requiredstatusstringrequiredAllowed:
waiting_cachecache_dispositionstringrequiredAllowed:
cache_joinreserved_creditsnumberrequiredAllowed:
0object
schema_versionstringrequiredAllowed:
research-job@1kindstringrequiredAllowed:
research_jobidstring<uuid>requiredcapability_idstringrequiredAllowed:
research.facebook-company-ads@1maximum_creditsintegerrequiredmin 0 · max 1000000000
created_atstring<date-time>requiredupdated_atstring<date-time>requiredstatusstringrequiredAllowed:
queuedcache_dispositionstringrequiredAllowed:
live_fetchreserved_creditsintegerrequiredmin 0 · max 1000000000
object
schema_versionstringrequiredAllowed:
research-job@1kindstringrequiredAllowed:
research_jobidstring<uuid>requiredcapability_idstringrequiredAllowed:
research.facebook-company-ads@1maximum_creditsintegerrequiredmin 0 · max 1000000000
created_atstring<date-time>requiredupdated_atstring<date-time>requiredstatusstringrequiredAllowed:
processingcache_dispositionstringrequiredAllowed:
live_fetchreserved_creditsintegerrequiredmin 0 · max 1000000000
started_atstring<date-time>requiredobject
schema_versionstringrequiredAllowed:
research-job@1kindstringrequiredAllowed:
research_jobidstring<uuid>requiredcapability_idstringrequiredAllowed:
research.facebook-company-ads@1maximum_creditsintegerrequiredmin 0 · max 1000000000
created_atstring<date-time>requiredupdated_atstring<date-time>requiredstatusstringrequiredAllowed:
succeededcache_dispositionstringrequiredAllowed:
cache_hitcache_joinlive_fetchcache_stalereserved_creditsintegerrequiredmin 0 · max 1000000000
settled_creditsintegerrequiredmin 0 · max 1000000000
completed_atstring<date-time>requiredresult_readybooleanrequiredAllowed:
trueobject
schema_versionstringrequiredAllowed:
research-job@1kindstringrequiredAllowed:
research_jobidstring<uuid>requiredcapability_idstringrequiredAllowed:
research.facebook-company-ads@1maximum_creditsintegerrequiredmin 0 · max 1000000000
created_atstring<date-time>requiredupdated_atstring<date-time>requiredstatusstringrequiredAllowed:
failedcache_dispositionstringrequiredAllowed:
cache_joinlive_fetchreserved_creditsintegerrequiredmin 0 · max 1000000000
settled_creditsnumberrequiredAllowed:
0completed_atstring<date-time>requirederrorobjectrequiredShow propertiesHide properties
codestringrequiredAllowed:
research_failednormalization_failedmessagestringrequiredAllowed:
Research request failedResearch result could not be normalizedobject
schema_versionstringrequiredAllowed:
research-job@1kindstringrequiredAllowed:
research_jobidstring<uuid>requiredcapability_idstringrequiredAllowed:
research.facebook-company-ads@1maximum_creditsintegerrequiredmin 0 · max 1000000000
created_atstring<date-time>requiredupdated_atstring<date-time>requiredstatusstringrequiredAllowed:
unknowncache_dispositionstringrequiredAllowed:
cache_joinlive_fetchreserved_creditsintegerrequiredmin 0 · max 1000000000
reconciliation_requiredbooleanrequiredAllowed:
true400Invalid request, idempotency key, or attribution
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1 · max length 128
messagestringrequiredmin length 1 · max length 2000
retryablebooleanrequiredrequest_idstring<uuid>requiredbalanceintegermin 0
requiredintegermin 0
fieldstringmin length 1 · max length 512
statestringmin length 1 · max length 128
retryWithNewKeybooleanparameterstringmin length 1 · max length 128
allowedstring[]max items 100
402Insufficient credits
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1 · max length 128
messagestringrequiredmin length 1 · max length 2000
retryablebooleanrequiredrequest_idstring<uuid>requiredbalanceintegermin 0
requiredintegermin 0
fieldstringmin length 1 · max length 512
statestringmin length 1 · max length 128
retryWithNewKeybooleanparameterstringmin length 1 · max length 128
allowedstring[]max items 100
403Explicit spend approval is required
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1 · max length 128
messagestringrequiredmin length 1 · max length 2000
retryablebooleanrequiredrequest_idstring<uuid>requiredbalanceintegermin 0
requiredintegermin 0
fieldstringmin length 1 · max length 512
statestringmin length 1 · max length 128
retryWithNewKeybooleanparameterstringmin length 1 · max length 128
allowedstring[]max items 100
409Quote conflict, expiry, or non-terminal retry
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1 · max length 128
messagestringrequiredmin length 1 · max length 2000
retryablebooleanrequiredrequest_idstring<uuid>requiredbalanceintegermin 0
requiredintegermin 0
fieldstringmin length 1 · max length 512
statestringmin length 1 · max length 128
retryWithNewKeybooleanparameterstringmin length 1 · max length 128
allowedstring[]max items 100
503Quote, billing, projection, or queue authority is unavailable
errorobjectrequiredShow propertiesHide properties
codestringrequiredmin length 1 · max length 128
messagestringrequiredmin length 1 · max length 2000
retryablebooleanrequiredrequest_idstring<uuid>requiredbalanceintegermin 0
requiredintegermin 0
fieldstringmin length 1 · max length 512
statestringmin length 1 · max length 128
retryWithNewKeybooleanparameterstringmin length 1 · max length 128
allowedstring[]max items 100
Request
curl -X POST "https://api.roasos.com/v1/research/jobs" \
-H "Idempotency-Key: string" \
-H "Content-Type: application/json" \
-d '{
"capability_id": "research.facebook-company-ads@1",
"target": {
"kind": "page_id",
"page_id": "string"
},
"filters": {
"country": "string",
"status": "ACTIVE",
"media_type": "ALL",
"language": "string",
"sort_by": "relevancy_monthly_grouped",
"start_date": "string",
"end_date": "string"
},
"page": {
"max_pages": 1,
"max_results": 0
},
"freshness": {
"max_age_seconds": 0,
"allow_stale": true
},
"quote_only": false,
"quote_id": "<uuid>"
}'const response = await fetch("https://api.roasos.com/v1/research/jobs", {
method: "POST",
headers: {
"Idempotency-Key": "string",
"Content-Type": "application/json"
},
body: JSON.stringify({
"capability_id": "research.facebook-company-ads@1",
"target": {
"kind": "page_id",
"page_id": "string"
},
"filters": {
"country": "string",
"status": "ACTIVE",
"media_type": "ALL",
"language": "string",
"sort_by": "relevancy_monthly_grouped",
"start_date": "string",
"end_date": "string"
},
"page": {
"max_pages": 1,
"max_results": 0
},
"freshness": {
"max_age_seconds": 0,
"allow_stale": true
},
"quote_only": false,
"quote_id": "<uuid>"
})
});import requests
response = requests.post(
"https://api.roasos.com/v1/research/jobs",
headers={
"Idempotency-Key": "string",
"Content-Type": "application/json"
},
json={
"capability_id": "research.facebook-company-ads@1",
"target": {
"kind": "page_id",
"page_id": "string"
},
"filters": {
"country": "string",
"status": "ACTIVE",
"media_type": "ALL",
"language": "string",
"sort_by": "relevancy_monthly_grouped",
"start_date": "string",
"end_date": "string"
},
"page": {
"max_pages": 1,
"max_results": 0
},
"freshness": {
"max_age_seconds": 0,
"allow_stale": True
},
"quote_only": False,
"quote_id": "<uuid>"
},
)Response
{
"data": {
"schema_version": "research-quote@1",
"kind": "research_quote",
"status": "quoted",
"quote_id": "<uuid>",
"capability_id": "research.facebook-company-ads@1",
"cache_disposition": "cache_hit",
"reserved_credits": 0,
"maximum_credits": 0,
"expires_at": "2024-01-01T00:00:00Z",
"pricing_version": "string",
"authorization": {
"status": "auto_approved"
},
"confirmation": {
"max_pages": 0,
"max_results": 0,
"max_age_seconds": 0,
"allow_stale": true
}
}
}{
"data": {
"schema_version": "research-job@1",
"kind": "research_job",
"id": "<uuid>",
"capability_id": "research.facebook-company-ads@1",
"maximum_credits": 0,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z",
"status": "quoted",
"cache_disposition": "live_fetch",
"reserved_credits": 0,
"quote_id": "<uuid>",
"expires_at": "2024-01-01T00:00:00Z"
}
}{
"error": {
"code": "string",
"message": "string",
"retryable": true,
"request_id": "<uuid>",
"balance": 0,
"required": 0,
"field": "string",
"state": "string",
"retryWithNewKey": true,
"parameter": "string",
"allowed": [
"string"
]
}
}{
"error": {
"code": "string",
"message": "string",
"retryable": true,
"request_id": "<uuid>",
"balance": 0,
"required": 0,
"field": "string",
"state": "string",
"retryWithNewKey": true,
"parameter": "string",
"allowed": [
"string"
]
}
}{
"error": {
"code": "string",
"message": "string",
"retryable": true,
"request_id": "<uuid>",
"balance": 0,
"required": 0,
"field": "string",
"state": "string",
"retryWithNewKey": true,
"parameter": "string",
"allowed": [
"string"
]
}
}{
"error": {
"code": "string",
"message": "string",
"retryable": true,
"request_id": "<uuid>",
"balance": 0,
"required": 0,
"field": "string",
"state": "string",
"retryWithNewKey": true,
"parameter": "string",
"allowed": [
"string"
]
}
}{
"error": {
"code": "string",
"message": "string",
"retryable": true,
"request_id": "<uuid>",
"balance": 0,
"required": 0,
"field": "string",
"state": "string",
"retryWithNewKey": true,
"parameter": "string",
"allowed": [
"string"
]
}
}