Authentication

Every Ranksy API v1 request is authenticated with an opaque API key sent as a Bearer token. Keys begin with rk_live_ or rk_test_. Each key belongs to exactly one Ranksy team and acts as the team member who created it: you can only reach the apps of that team, with that member's permissions.

Making authenticated requests

Include your key in the Authorization header of every request using the Bearer scheme:

Authorization header

Authorization: Bearer rk_live_xxxxxxxxxxxxxxxxxxxxxxxx

Example request

curl https://ranksyapp.com/api/v1/apps/01JN4HKQX0000000000000000/metrics/mrr \
  -H "Authorization: Bearer rk_live_xxxxxxxxxxxxxxxxxxxxxxxx"

Getting a key

Any member of a team can create API keys for it. A key can carry only the permissions that its creator holds on the team.

  1. In Ranksy, open Settings, then API Keys.
  2. Click Create key.
  3. Optionally, give the key a Label, for example Production server.
  4. Choose the Environment: Live or Test. See Live and test keys.
  5. Choose the key's Permissions. The picker is the same one the team owner uses for members in Team Settings → Members → Permissions, with the same groups and presets. A new key starts with every permission you hold. Permissions you don't hold are shown but can't be selected. Select at least one. See Permissions.
  6. Optionally, set an Expiry date. Leave it blank for a key that never expires.
  7. Click Create key, then copy the key. Ranksy shows it only once and stores only a hash of it. If you lose a key, revoke it and create a new one.

Members see the keys they created. The team owner sees every key on the team, with a Created by column. To revoke a key, click the delete icon on its row in API Keys. The member who created a key can revoke it, and so can the team owner. Every request made with a revoked or expired key fails with 401 missing_api_key.

A key belongs to one team and acts as the member who created it. Every request made with it is limited to that team's apps and to what that member may see. If the member leaves the team or is removed from it, their keys stop working and return 401 missing_api_key. The REST API also needs an active Ranksy subscription on the team: without one, every request except /identify, /track, and /capi returns 402 subscription_required. Requests are limited per app per minute, and reads count toward a monthly plan quota. See Rate limits.

Live and test keys

The prefix shows which Environment you chose when you created the key:

  • Name
    rk_live_
    Type
    live key
    Description

    A key for your production integration.

  • Name
    rk_test_
    Type
    test key
    Description

    A key for development. A test key works the same as a live key: it reads and writes the same team data, and its requests count toward the same plan quota. Use the prefix to tell your development keys apart from your production keys.

Permissions

A key carries a set of team permissions, the same permissions a team owner grants to members in Team Settings → Members → Permissions, such as revenue.overview, crm.access, or aso.keywords. Each endpoint requires one or more of them, listed below.

Ranksy checks a permission on every request, against the key and against the member who created it. A request passes only if the key carries the permission and that member still holds it on the team. So a key's access is the intersection of its own permissions and its creator's current permissions:

  • When the team owner removes a permission from a member, the member's keys lose it on their next request. You don't need to create the keys again.
  • When the team owner gives the permission back, the keys that carry it work again.
  • A key never gains a permission it wasn't created with. To add one, create a new key.

When a check fails, the request returns 403 insufficient_permissions. The message names the permission the endpoint requires:

403 — insufficient_permissions

{
  "error": {
    "type": "permission_error",
    "code": "insufficient_permissions",
    "message": "This endpoint requires the 'revenue.churn' team permission, on the API key and on the member who created it.",
    "doc_url": "https://api.ranksyapp.com/errors#insufficient_permissions"
  }
}

The team owner holds every permission, so the owner's keys are limited only by the permissions selected for the key.

Revenue amounts

Endpoints whose rows carry dollar amounts, such as subscriptions, churned customers, or LTV per customer, need a second permission besides the one for their page: revenue.overview or revenue.earnings. A member who can't see revenue figures in Ranksy can't read them through the API either. In the table below, these endpoints are marked + revenue.

Permissions by endpoint

Paths are relative to https://ranksyapp.com/api/v1.

EndpointRequired permission
GET /__ping, GET /menone
GET /apps, GET /apps/{app}, GET /apps/{app}/listing, GET /apps/{app}/reviewsnone
Catalog: GET /catalog/*, GET /categories/*none
Metrics: mrr, arr, revenuerevenue.overview
Metrics: ltvrevenue.ltv + revenue
Metrics: nrrrevenue.nrr
Metrics: active_trials, trial_conversion_raterevenue.trials
Metrics: active_merchants, active_subscriptionsrevenue.subscriptions
Metrics: installs, uninstalls, reactivations, deactivationsrevenue.installations
Metrics: churned_total, subscription_churn_rate, gross_revenue_churn_rate, net_revenue_churn_rate, and the aliases churn_rate, revenue_churn_raterevenue.churn
Metrics: usage_revenuerevenue.earnings
GET /apps/{app}/revenue/overviewrevenue.overview
Transactionsrevenue.earnings
Subscriptions, Lifecycle eventsrevenue.subscriptions + revenue
Churn analysis, Churned customersrevenue.churn + revenue
GET /apps/{app}/active-trialsrevenue.trials + revenue
LTV cohorts, Customer LTVrevenue.ltv + revenue
GET /apps/{app}/retention/cohortsrevenue.retention
Store installs, GET /apps/{app}/uninstall-reasonsrevenue.installations
Customers, Notes, Tasks, customer tags (reads and writes)crm.access
GET /apps/{app}/automations/rules, …/rules/{rule}, …/rules/{rule}/runs, POST …/rules/{rule}/enrollcrm.automations
Usage eventscrm.access
Usage metricsusage.events (the billed_usage figure needs revenue too)
Traffic: traffic/sources, traffic/keywords, traffic/overview, traffic/source-trendstraffic.sources
Traffic: traffic/journey, traffic/funnel, installs, keywords/installs-by-sourcetraffic.attribution
Traffic: traffic/attributiontraffic.attribution + revenue
keywords/cannibalization, keywords/ad-performancetraffic.ads
Shopify App Store ads: overview, trend, keywords, search-terms, changestraffic.ads (the revenue and roas fields need revenue too)
Rankings: rankings, rankings/history, rankings/by-keyword/{keyword}aso.keywords
GET /apps/{app}/keywords, keywords/{keyword}/trends, listing/outranked-keywordsaso.keywords
GET /apps/{app}/keywords/focus, tracking and untracking keywords (POST /apps/{app}/keywords, DELETE /apps/{app}/keywords/{keyword})aso.tracked
Scorecard, Competitors, listing/competitorsaso.competitors
POST /apps/{app}/listing/improve, GET /apps/{app}/listing/improvements/{id}ai.access
Identify, Track events, Conversion signals, POST /apps/{app}/shopify-ads/syncintegrations.manage

Identify, Track events, Conversion signals, and the ads sync send data in from your app's backend, so they need Manage Integrations (integrations.manage). Give your server's key that permission, and leave it off keys that only read data.

The Ranksy CLI uses the same keys. Each command needs the permission of the endpoint it calls.

Scopes

Keys created before permissions carry scopes instead, such as metrics:read or crm:write. These keys keep working with the access they had: Ranksy gave each one the permissions that cover its scopes, and checks both on every request. An older key with Full access (*) received every permission.

There are 17 scopes. GET /__ping and GET /me need none:

ScopeWhat it covers
apps:readGET /apps, GET /apps/{app}, listing, listing/competitors, listing/outranked-keywords, GET listing/improvements/{id}
metrics:readMetrics and the revenue rows behind them: subscriptions, transactions, revenue/overview, churn, retention/cohorts, ltv/*, uninstall-reasons, active-trials, churned-customers, store-installs, lifecycle-events. Also the revenue and roas fields of the Shopify App Store ads endpoints
traffic:readtraffic/*, installs, GET keywords, keywords/cannibalization, keywords/ad-performance, keywords/installs-by-source, keywords/{keyword}/trends
rankings:readrankings, rankings/history, rankings/by-keyword/{keyword}, keywords/focus
reviews:readGET /apps/{app}/reviews
catalog:readGET /catalog/*, GET /categories/*
scorecard:readscorecard
competitors:readcompetitors
usage:readusage-events, usage-metrics
crm:readReading customers, notes, tasks, customer tags, and automation rules and runs
crm:writeidentify, track, writing notes, tasks, and customer tags, and POST automations/rules/{rule}/enroll
capi:writecapi
appevents:write/track calls that carry an event_handle (Shopify App Events and usage events). Without it, /track records only the activity ping, skips the event, and returns shopify_event.status skipped
keywords:writePOST /apps/{app}/keywords, DELETE /apps/{app}/keywords/{keyword}
listing:writePOST /apps/{app}/listing/improve
ads:writePOST /apps/{app}/shopify-ads/sync
ads:readshopify-ads/overview, trend, keywords, search-terms, changes

Keys created with the permission picker carry the wildcard scope *, so only their permissions limit them. If an older key returns 403 insufficient_permissions with a message that names a scope, for example This API key is missing the 'metrics:read' scope., create a new key with the permissions you need.

What can go wrong

Authentication and authorization failures are reported through the standard error envelope:

  • Name
    401 — missing_api_key
    Type
    authentication_error
    Description

    The Authorization header is absent, or the key is unknown, revoked, or expired, or the member who created it is no longer on the team.

  • Name
    401 — missing_team_scope
    Type
    authentication_error
    Description

    The request reached the API without a key or a team to scope it to, so no apps can be resolved. A key whose team no longer exists fails with missing_api_key instead.

  • Name
    402 — subscription_required
    Type
    payment_required_error
    Description

    The team has no active Ranksy subscription. Every request fails except the ingestion writes /identify, /track, and /capi, which keep working.

  • Name
    403 — insufficient_permissions
    Type
    permission_error
    Description

    The key, or the member who created it, lacks a permission that the endpoint requires. The message names the permission. An older key that lacks a scope gets the same code, with a message that names the scope. An MCP OAuth token sent to /api/v1 gets it too.