Skip to content
Open Onsite

API reference

Get new and lost keywords

GET
/sites/{site}/performance/new-and-lost
Code sample: curl
curl "https://api.onsite.so/api/v1/sites/example.com/performance/new-and-lost" \
-H "Authorization: Bearer $ONSITE_API_KEY"

Counts the searches the site started ranking for in the period and the ones it stopped ranking for, by position, with the biggest of each.

site
required
string

Example

example.com

The site: its ID, its address in Onsite, its domain or its Search Console property, as List sites shows them.

range
string
default: last_28d <= 40 characters

The period: last_7d, last_14d, last_28d, last_3m, last_6m, last_12m, last_16m, this_month, last_month, last_quarter or year_to_date, or two dates like 2026-08-01..2026-08-31. Presets end on the latest day with complete data.

compare
string
default: previous_period
Allowed values: previous_period previous_year none

What to compare with: the same number of days just before (previous_period), the same days a year earlier with weekdays matched (previous_year), or nothing (none).

search_type
string
default: web
Allowed values: web image video news discover google_news

The Search Console search type.

query
string
>= 1 characters <= 300 characters

Only searches matching this text. See query_match.

query_match
string
default: contains
Allowed values: contains not_contains exact regex

How query matches: contains, not_contains, exact or regex.

page
string
>= 1 characters <= 300 characters

Only pages whose URL matches this text. See page_match.

page_match
string
default: contains
Allowed values: contains not_contains exact regex

How page matches: contains, not_contains, exact or regex.

country
string

Only these countries, comma-separated: ISO codes (usa, gb) or English names.

device
string

Only these devices, comma-separated: desktop, mobile, tablet.

brand
string
Allowed values: branded non_branded

Only branded or only non-branded searches, by the site’s branded terms.

position
string
Allowed values: top3 top10 top20 striking

Only searches ranking in this band: top3, top10, top20, or striking (positions 4 to 20).

bucket
string
>= 1 characters <= 300 characters

Only searches in this bucket, by its name as Get a site lists it.

page_type
string
>= 1 characters <= 300 characters

Only pages of this page type, by its name as Get a site lists it.

question
boolean

True: only searches phrased as a question.

OK

Media typeapplication/json
object
site
required

The site’s address, as Search Console names the property.

string
period
required

The dates the numbers cover, in the site’s Search Console time zone (Pacific Time).

object
from
required

First day of the period.

string format: date
to
required

Last day of the period. Presets end on the latest day with complete data.

string format: date
days
required

Number of days in the period.

integer
comparison
required

The period compared with, or null when compare is none or Search Console no longer keeps those dates.

Any of:

The dates the numbers cover, in the site’s Search Console time zone (Pacific Time).

object
from
required

First day of the period.

string format: date
to
required

Last day of the period. Presets end on the latest day with complete data.

string format: date
days
required

Number of days in the period.

integer
searchType
required

The Search Console search type the numbers are for.

string
filters
required

The filters applied, in the form Onsite’s Overview shows them.

Array<string>
new
required
object
total
required

Searches that started ranking in the period.

integer
byPosition
required

The searches by the position they ranked at.

object
top10
required

In positions 1 to 10.

integer
11_20
required

In positions 11 to 20.

integer
21_50
required

In positions 21 to 50.

integer
51_plus
required

In position 51 or lower.

integer
biggest
required

The new searches with the most impressions.

Array<object>
object
query
required

The search.

string
firstSeen
required

The first day it ranked.

string format: date
position
required
Any of:

Average position since.

number
impressions
required

Impressions since.

integer
lost
required
object
total
required

Searches that stopped ranking in the period. A search counts as lost once it has been gone for 7 days.

integer
byPosition
required

The searches by the position they ranked at.

object
top10
required

In positions 1 to 10.

integer
11_20
required

In positions 11 to 20.

integer
21_50
required

In positions 21 to 50.

integer
51_plus
required

In position 51 or lower.

integer
biggest
required

The lost searches that had the most clicks.

Array<object>
object
query
required

The search.

string
lastSeen
required

The last day it ranked.

string format: date
position
required
Any of:

Average position before it stopped.

number
clicks
required

Clicks before it stopped.

integer

Example

{
"site": "https://example.com/",
"period": {
"from": "2026-09-30",
"to": "2026-10-27",
"days": 28
},
"comparison": {
"from": "2026-09-30",
"to": "2026-10-27",
"days": 28
},
"searchType": "web",
"filters": [
"brand:non-branded"
],
"new": {
"total": 147,
"byPosition": {
"top10": 12,
"11_20": 30,
"21_50": 64,
"51_plus": 41
},
"biggest": [
{
"query": "trail running shoes",
"firstSeen": "2026-10-27",
"position": 8.4,
"impressions": 420
}
]
},
"lost": {
"total": 52,
"byPosition": {
"top10": 12,
"11_20": 30,
"21_50": 64,
"51_plus": 41
},
"biggest": [
{
"query": "winter boots",
"lastSeen": "2026-10-12",
"position": 11.2,
"clicks": 35
}
]
}
}

A parameter or body field isn’t valid. error.param names it.

Media typeapplication/json
object
error
required
object
code
required

What went wrong, as a stable word your code can check.

string
Allowed values: invalid_input unauthenticated forbidden not_found payment_required credits_exhausted conflict rate_limited quota_limited search_data_unavailable search_data_changed google_access_lost maintenance internal
message
required

What went wrong, in a sentence a person can act on.

string
param

The parameter or body field at fault, when there is one.

string
allowed

The values it accepts, when there is a fixed set.

Array<string>
didYouMean

The closest allowed value, when the one sent looks like a typo.

string
requestId
required

Quote it to support to find this request.

string

Example

{
"error": {
"code": "invalid_input",
"message": "range must be last_7d, last_14d, last_28d, last_3m, last_6m, last_12m, last_16m, this_month, last_month, last_quarter, year_to_date, or a window like 2026-08-01..2026-08-31.",
"param": "range",
"didYouMean": "last_28d",
"requestId": "E-7K2Q-M4XD"
}
}

The API key is missing, wrong, expired or revoked.

Media typeapplication/json
object
error
required
object
code
required

What went wrong, as a stable word your code can check.

string
Allowed values: invalid_input unauthenticated forbidden not_found payment_required credits_exhausted conflict rate_limited quota_limited search_data_unavailable search_data_changed google_access_lost maintenance internal
message
required

What went wrong, in a sentence a person can act on.

string
param

The parameter or body field at fault, when there is one.

string
allowed

The values it accepts, when there is a fixed set.

Array<string>
didYouMean

The closest allowed value, when the one sent looks like a typo.

string
requestId
required

Quote it to support to find this request.

string

Example

{
"error": {
"code": "invalid_input",
"message": "range must be last_7d, last_14d, last_28d, last_3m, last_6m, last_12m, last_16m, this_month, last_month, last_quarter, year_to_date, or a window like 2026-08-01..2026-08-31.",
"param": "range",
"didYouMean": "last_28d",
"requestId": "E-7K2Q-M4XD"
}
}

Your team needs an Onsite plan, or has used this month’s credits (exports only).

Media typeapplication/json
object
error
required
object
code
required

What went wrong, as a stable word your code can check.

string
Allowed values: invalid_input unauthenticated forbidden not_found payment_required credits_exhausted conflict rate_limited quota_limited search_data_unavailable search_data_changed google_access_lost maintenance internal
message
required

What went wrong, in a sentence a person can act on.

string
param

The parameter or body field at fault, when there is one.

string
allowed

The values it accepts, when there is a fixed set.

Array<string>
didYouMean

The closest allowed value, when the one sent looks like a typo.

string
requestId
required

Quote it to support to find this request.

string

Example

{
"error": {
"code": "invalid_input",
"message": "range must be last_7d, last_14d, last_28d, last_3m, last_6m, last_12m, last_16m, this_month, last_month, last_quarter, year_to_date, or a window like 2026-08-01..2026-08-31.",
"param": "range",
"didYouMean": "last_28d",
"requestId": "E-7K2Q-M4XD"
}
}

The key can’t do this: it is limited to other sites, it can only read, or its owner’s role doesn’t allow it.

Media typeapplication/json
object
error
required
object
code
required

What went wrong, as a stable word your code can check.

string
Allowed values: invalid_input unauthenticated forbidden not_found payment_required credits_exhausted conflict rate_limited quota_limited search_data_unavailable search_data_changed google_access_lost maintenance internal
message
required

What went wrong, in a sentence a person can act on.

string
param

The parameter or body field at fault, when there is one.

string
allowed

The values it accepts, when there is a fixed set.

Array<string>
didYouMean

The closest allowed value, when the one sent looks like a typo.

string
requestId
required

Quote it to support to find this request.

string

Example

{
"error": {
"code": "invalid_input",
"message": "range must be last_7d, last_14d, last_28d, last_3m, last_6m, last_12m, last_16m, this_month, last_month, last_quarter, year_to_date, or a window like 2026-08-01..2026-08-31.",
"param": "range",
"didYouMean": "last_28d",
"requestId": "E-7K2Q-M4XD"
}
}

The site, or the thing asked for on it, doesn’t exist or this key can’t read it.

Media typeapplication/json
object
error
required
object
code
required

What went wrong, as a stable word your code can check.

string
Allowed values: invalid_input unauthenticated forbidden not_found payment_required credits_exhausted conflict rate_limited quota_limited search_data_unavailable search_data_changed google_access_lost maintenance internal
message
required

What went wrong, in a sentence a person can act on.

string
param

The parameter or body field at fault, when there is one.

string
allowed

The values it accepts, when there is a fixed set.

Array<string>
didYouMean

The closest allowed value, when the one sent looks like a typo.

string
requestId
required

Quote it to support to find this request.

string

Example

{
"error": {
"code": "invalid_input",
"message": "range must be last_7d, last_14d, last_28d, last_3m, last_6m, last_12m, last_16m, this_month, last_month, last_quarter, year_to_date, or a window like 2026-08-01..2026-08-31.",
"param": "range",
"didYouMean": "last_28d",
"requestId": "E-7K2Q-M4XD"
}
}

Too many requests for this key. Wait for the Retry-After header’s seconds.

Media typeapplication/json
object
error
required
object
code
required

What went wrong, as a stable word your code can check.

string
Allowed values: invalid_input unauthenticated forbidden not_found payment_required credits_exhausted conflict rate_limited quota_limited search_data_unavailable search_data_changed google_access_lost maintenance internal
message
required

What went wrong, in a sentence a person can act on.

string
param

The parameter or body field at fault, when there is one.

string
allowed

The values it accepts, when there is a fixed set.

Array<string>
didYouMean

The closest allowed value, when the one sent looks like a typo.

string
requestId
required

Quote it to support to find this request.

string

Example

{
"error": {
"code": "invalid_input",
"message": "range must be last_7d, last_14d, last_28d, last_3m, last_6m, last_12m, last_16m, this_month, last_month, last_quarter, year_to_date, or a window like 2026-08-01..2026-08-31.",
"param": "range",
"didYouMean": "last_28d",
"requestId": "E-7K2Q-M4XD"
}
}

Onsite is down for maintenance, or new data arrived while reading. Try again after the Retry-After header’s seconds.

Media typeapplication/json
object
error
required
object
code
required

What went wrong, as a stable word your code can check.

string
Allowed values: invalid_input unauthenticated forbidden not_found payment_required credits_exhausted conflict rate_limited quota_limited search_data_unavailable search_data_changed google_access_lost maintenance internal
message
required

What went wrong, in a sentence a person can act on.

string
param

The parameter or body field at fault, when there is one.

string
allowed

The values it accepts, when there is a fixed set.

Array<string>
didYouMean

The closest allowed value, when the one sent looks like a typo.

string
requestId
required

Quote it to support to find this request.

string

Example

{
"error": {
"code": "invalid_input",
"message": "range must be last_7d, last_14d, last_28d, last_3m, last_6m, last_12m, last_16m, this_month, last_month, last_quarter, year_to_date, or a window like 2026-08-01..2026-08-31.",
"param": "range",
"didYouMean": "last_28d",
"requestId": "E-7K2Q-M4XD"
}
}