Open API

Errors

### Open API

Use the Rankhog public REST API with OpenAPI, scoped auth, idempotency, and safe Reddit workflows.

Rankhog exposes the same paid agent capabilities through REST, MCP, and the CLI. Use REST when an external service or AI agent needs stable HTTP endpoints, OpenAPI schemas, idempotent writes, and status polling.

### Base URL Copy Anchor Link

RANKHOG\_API\_BASE\_URL

=

"https://api.rankhog.com"

The OpenAPI 3.1 document is available at:

curl

https://api.rankhog.com/agent/openapi.json

See the generated API reference for every endpoint schema, response, auth mode, and example.

### Authentication Copy Anchor Link

REST supports two auth paths:

Organization API key : send Authorization: Bearer rhog\_... or x-api-key . Owners and admins create one in organization settings. It is shown once, then stays hidden: the first characters settings shows are not the key, and sending them answers agentic\_invalid\_api\_key . To see a key again, create a new one.

CLI bearer token : minted by Better Auth device authorization.

API keys are organization automation credentials. Existing read only , read and draft (default), and automation presets retain their permissions. Growth operations adds product, strategy, and warm-up configuration to automation. Growth operations and safety resolutions additionally permits safety incidents, uncertain submissions, and review-prompt changes. Existing keys are never upgraded automatically.

| Capability | Required permission |
| --- | --- |
| Read growth state, diagnostics, jobs, and credit balance | rankhog:read |
| Read the credit ledger | credits:read |
| Change product answers, market, or automation mode | product:write |
| Configure Discovery and Radar | strategy:write |
| Configure/stop warm-up | warmup:write |
| Start warm-up execution | warmup:write and reddit:write:dangerous |
| Edit drafts and writing profiles | reddit:draft:write |
| Resolve safety incidents or uncertain submissions; change review prompts | growth:safety:write , plus the operation's configuration permission |
| Execute/retry Reddit writes | reddit:write:dangerous , plus the operation's draft permission. Only a person can turn autopilot on, in the app |
| Set up a product and its free report | setup:write (OAuth or a signed-in session, never an API key) |
| Start conversations, post conversation messages and structured question answers | conversation:write |
| Cancel, reschedule, or retry jobs | jobs:write |
| Buy credits, change billing, delete data, manage team/security, change account protection | Not exposed |

API keys need the listed scopes. Human session actors retain their existing role checks. open\_reddit\_url remains human-authenticated. Get credit purchase link returns a Rankhog billing URL where an authorized human completes checkout; it never charges a card.

Mutations require an idempotencyKey . Reuse the key only with identical input: retries return the committed result, while different input returns agentic\_idempotency\_conflict . Permissions and product access are checked again before replay. Durable mutations are limited to 120 per actor and organization per hour; operation-specific limits can be lower.

The retired approve\_reddit\_draft and dangerously\_submit\_reddit\_post endpoints have been removed. Use create\_reddit\_action followed by execute\_reddit\_action , or confirm\_opportunity\_action for a linked opportunity. update\_opportunity\_draft now also requires an idempotency key. Text posts use the Desktop post workflow after explicit dangerous execution authorization. A stored draft is not proof of a submission. Execution status reports humanNeeded when a person must finish or verify a step in Desktop; API keys cannot mark that human step done.

The warm-up participation and community endpoints were removed: get\_warmup\_participation\_profile , update\_warmup\_participation\_profile , preview\_warmup\_communities and confirm\_warmup\_communities are no longer available. Rankhog picks a warm-up's rooms from the account's phase (AskReddit first, then two or three of r/todayilearned, r/CasualConversation, r/NoStupidQuestions and r/explainlikeimfive as the account builds), and they cannot be edited. To steer a single comment, call find\_warmup\_comment\_now with a subreddit among the plan's rooms.

Once a warm-up account has built up, Rankhog also picks threads from the product's own rooms for it: the best open Radar find becomes a warm-up card, a person answers one question about it or writes the comment, and a person confirms it. List opportunities with warmupTarget: true lists them, and the conversation endpoints read the question. An answer with words must come from a signed-in person. Confirm opportunity action and execute Reddit action refuse these cards for API keys, MCP and the CLI, because a person always confirms. A card nobody acts on closes by itself 24 hours after it was found. Start warm-up takes targetCardsPerDay : 0 is off, 1 is one a day (the default), 2 lets a find scoring 80 or more bring a second card the same day.

Every error uses one JSON envelope; see the error catalog for all codes, statuses, and remediation. Rate limited responses carry a Retry-After header.

### Discovery and Radar Copy Anchor Link

Read the current product-owned strategy:

curl

"

$RANKHOG\_API\_BASE\_URL

/agent/v1/strategy"

\\

-H

"Authorization: Bearer

$RANKHOG\_ACCESS\_TOKEN

"

\\

-H

"Content-Type: application/json"

\\

--data

'\{

"organizationId": "org\_...",

"websiteId": "web\_..."

\}'

Strategy mutations require strategy:write . Organization API keys may receive this explicit grant; human actors must also be organization owners or admins.

curl

"

$RANKHOG\_API\_BASE\_URL

/agent/v1/strategy/discovery/start"

\\

-H

"Authorization: Bearer

$RANKHOG\_ACCESS\_TOKEN

"

\\

-H

"Content-Type: application/json"

\\

--data

'\{

"organizationId": "org\_...",

"websiteId": "web\_...",

"direction": "Find comparison demand",

"idempotencyKey": "start-discovery-001"

\}'

Stopping Discovery uses /strategy/discovery/stop ; running it now uses /strategy/discovery/run . Radar coverage is /strategy/radar/coverage , Radar control is /strategy/radar , and shared input replacement is /strategy/inputs . These endpoints change only the named lane or inputs.

### Quickstart Copy Anchor Link

List workspaces, create a Reddit action, execute it, then poll status.

export

RANKHOG\_API\_BASE\_URL

=

"https://api.rankhog.com"

export

RANKHOG\_API\_KEY

=

"rhog\_..."

curl

"

$RANKHOG\_API\_BASE\_URL

/agent/v1/workspaces"

\\

-H

"Authorization: Bearer

$RANKHOG\_API\_KEY

"

\\

-H

"Content-Type: application/json"

\\

--data

'\{\}'

Use the returned organization.id , website.id , and managedRedditAccount.id in later calls.

Read the workspace's current opportunities before creating or executing work:

curl

"

$RANKHOG\_API\_BASE\_URL

/agent/v1/opportunities"

\\

-H

"Authorization: Bearer

$RANKHOG\_API\_KEY

"

\\

-H

"Content-Type: application/json"

\\

--data

'\{

"organizationId": "org\_...",

"websiteId": "web\_...",

"managedRedditAccountId": "acct\_...",

"includeRecent": false,

"limit": 50

\}'

Opportunity responses preserve evidence and may add evidenceSummary , timeZone , and nextTransitionAt . These read fields never approve or execute Reddit work.

Create a stored action. Every write needs an idempotency key.

curl

"

$RANKHOG\_API\_BASE\_URL

/agent/v1/reddit-actions"

\\

-H

"Authorization: Bearer

$RANKHOG\_API\_KEY

"

\\

-H

"Content-Type: application/json"

\\

--data

'\{

"organizationId": "org\_...",

"managedRedditAccountId": "acct\_...",

"actionType": "comment",

"targetUrl": "https://www.reddit.com/r/SaaS/comments/examplepost/example/",

"body": "We saw better activation after asking for one setup action instead of showing a long checklist.",

"riskSummary": "Contextual reply with no link and no promotional claim.",

"idempotencyKey": "action-comment-2026-06-17-001"

\}'

Execute the authorized action. The response is immediate and means the execution was queued, not necessarily submitted.

curl

"

$RANKHOG\_API\_BASE\_URL

/agent/v1/reddit-actions/execute"

\\

-H

"Authorization: Bearer

$RANKHOG\_API\_KEY

"

\\

-H

"Content-Type: application/json"

\\

--data

'\{

"organizationId": "org\_...",

"managedRedditAccountId": "acct\_...",

"plannedRedditActionId": "act\_...",

"acknowledgement": "I understand this can publish or change Reddit state from the user's

Reddit

account.",

"requestedExecutorRedditAccountId": "ra\_...",

"idempotencyKey": "execute-action-2026-06-17-001"

\}'

Omit requestedExecutorRedditAccountId to let Rankhog pick the first ready product-granted Reddit account.

Queued response:

\{

"status"

:

"queued"

,

"executionId"

:

"job\_..."

,

"jobId"

:

"job\_..."

,

"plannedRedditActionId"

:

"act\_..."

,

"statusUrl"

:

"/agent/v1/reddit-action-executions/status?executionId=job\_..."

\}

Poll status:

curl

"

$RANKHOG\_API\_BASE\_URL

/agent/v1/reddit-action-executions/status"

\\

-H

"Authorization: Bearer

$RANKHOG\_API\_KEY

"

\\

-H

"Content-Type: application/json"

\\

--data

'\{

"organizationId": "org\_...",

"managedRedditAccountId": "acct\_...",

"executionId": "job\_..."

\}'

Successful status includes the final Reddit location.

\{

"status"

:

"succeeded"

,

"executionId"

:

"job\_..."

,

"plannedRedditActionId"

:

"act\_..."

,

"redditAction"

: \{

"redditActionId"

:

"ra\_..."

,

"permalink"

:

"https://www.reddit.com/r/SaaS/comments/examplepost/example/examplecomment/"

,

"currentUrl"

:

"https://www.reddit.com/r/SaaS/comments/examplepost/example/examplecomment/"

,

"submittedAt"

:

"2026-06-17T11:46:08.000Z"

,

"subreddit"

:

"SaaS"

,

"type"

:

"comment"

\},

"failure"

:

null

\}

Failed status includes machine-readable remediation.

\{

"status"

:

"failed"

,

"failedStepId"

:

"validate\_subreddit\_rules"

,

"failure"

: \{

"reasonCode"

:

"rules\_unavailable"

,

"message"

:

"The subreddit rules could not be verified before execution."

,

"retryable"

:

true

,

"failedStepId"

:

"validate\_subreddit\_rules"

,

"remediation"

:

"Refresh subreddit rules in Rankhog, review the planned action, then execute again with a new idempotency key."

\}

\}

### Credits Copy Anchor Link

Drafts and warm-ups spend credits; sending a post, comment, or reply is free. Read what a product can spend before queuing work:

curl

"

$RANKHOG\_API\_BASE\_URL

/agent/v1/credits/balance"

\\

-H

"Authorization: Bearer

$RANKHOG\_API\_KEY

"

\\

-H

"Content-Type: application/json"

\\

--data

'\{

"organizationId": "org\_...",

"websiteId": "web\_..."

\}'

\{

"organizationId"

:

"org\_..."

,

"websiteId"

:

"web\_..."

,

"period"

: \{

"allotment"

:

100

,

"remaining"

:

82

,

"available"

:

82

,

"periodStart"

:

"2026-06-01T00:00:00.000Z"

,

"periodEnd"

:

"2026-07-01T00:00:00.000Z"

,

"source"

:

"stripe\_subscription"

\},

"bank"

: \{

"available"

:

130

,

"balance"

:

130

\},

"available"

:

212

,

"committed"

:

4

,

"spendable"

:

208

,

"costs"

: \{

"warmup"

:

50

,

"draft"

:

1

,

"warmup\_draft"

:

0

,

"post"

:

0

,

"comment"

:

0

,

"reply"

:

0

,

"upvote"

:

0

,

"draft\_regeneration"

:

1

,

"managed\_proxy"

:

5

\},

"monthlyAllotmentPerProduct"

:

100

,

"lowBalanceThreshold"

:

20

,

"products"

: \[\{

"websiteId"

:

"web\_..."

,

"displayName"

:

"Example SaaS"

,

"available"

:

212

,

"committed"

:

4

,

"spendable"

:

208

,

"period"

: \{

"allotment"

:

100

\} \}\]

\}

period is this product's monthly credits, bank is the organization pool shared by every product, and spendable is available minus credits committed to queued actions. Omit websiteId to read the bank alone.

costs is the live price table. A draft ( draft ) costs credits when it is saved, whether you asked for it or autopilot wrote it. Sending a post, comment, or reply costs 0 . A rewrite you ask for is charged draft\_regeneration on every second rewrite, so it averages half a credit.

Page through the ledger with /agent/v1/credits/ledger ( credits:read ). Every grant, purchase, refund, adjustment, and debit is one row with its actorKind and the action, warm-up, purchase, or opportunity it paid for. Pass the previous nextCursor as cursor ; it is null on the last page. Member names and user ids are never included.

curl

"

$RANKHOG\_API\_BASE\_URL

/agent/v1/credits/ledger"

\\

-H

"Authorization: Bearer

$RANKHOG\_API\_KEY

"

\\

-H

"Content-Type: application/json"

\\

--data

'\{

"organizationId": "org\_...",

"websiteId": "web\_...",

"limit": 25

\}'

Both reads need organization membership only, so they work on lapsed and locked workspaces. execute\_reddit\_action returns 402 agentic\_insufficient\_credits with required , available , and spendable when the product cannot spend the action's cost. Buying credit packs, auto top-up, and admin adjustments are billing changes and stay in the Rankhog app.

### Idempotency Copy Anchor Link

All writes require a caller idempotencyKey . Rankhog also derives a server-side key from plannedRedditActionId .

Duplicate execute calls for the same planned action return the existing execution.

Already submitted actions return the existing submitted Reddit action.

Ambiguous final-submit states return verification\_required ; do not blindly retry.

### Statuses Copy Anchor Link

get\_reddit\_action\_execution\_status returns one of:

queued

running

succeeded

failed

blocked

cancelled

verification\_required

verification\_required means Reddit may have accepted the final submit, but Rankhog could not prove it. Check Reddit or refresh state before retrying with a new idempotency key.

### Safety Copy Anchor Link

Rankhog validates permissions/scopes before queueing execution. The execution layer then checks billing, account grants, action readiness, pacing, URL policy, Desktop readiness, Reddit account match, challenge pages, idempotency, and final verification. Public clients send high-level workflow requests only; raw browser control is not exposed.

Every execution also respects the selected identity's Reddit account protection policy . Weighted hourly and daily budgets and minimum spacing can delay or block an action. REST and organization API keys cannot change that human-owned policy. A single send can skip it only with skipPacing , described below.

The retired post-submission endpoint has been removed. Use create\_reddit\_action , execute\_reddit\_action , and get\_reddit\_action\_execution\_status .

### Working the Opportunity Inbox Copy Anchor Link

An agent can now work an opportunity end to end: read it, edit its draft, send it, or cancel it.

curl

"

$RANKHOG\_API\_BASE\_URL

/agent/v1/opportunities/confirm"

\\

-H

"Authorization: Bearer

$RANKHOG\_API\_KEY

"

\\

-H

"Content-Type: application/json"

\\

--data

'\{

"organizationId": "org\_...",

"websiteId": "web\_...",

"managedRedditAccountId": "acct\_...",

"opportunityId": "opp\_...",

"when": \{ "mode": "now" \},

"idempotencyKey": "confirm-opp-001"

\}'

Confirm needs the automation preset ( reddit:write:dangerous ). /opportunities/cancel cancels pending execution and dismisses the opportunity; /opportunities/draft edits the linked draft with reddit:draft:write and an idempotency key. Poll the returned jobId through /agent/v1/reddit-action-executions/status .

when picks the send time. \{ "mode": "suggested" \} (the default) keeps the paced slot, \{ "mode": "now" \} sends as soon as pacing allows, and \{ "mode": "custom", "at": "2026-11-02T14:30:00.000Z" \} sends at that UTC instant or the next slot pacing allows. A time that has passed means now.

Pacing stays on unless you ask otherwise. Add "skipPacing": true to send at exactly the time when asks for, even if the account's daily, hourly or spacing limits would wait. That raises the risk of a Reddit ban, and the risk is the account owner's. Every confirm answer includes a pacing object: skipped says whether pacing was skipped, and note says what that means for this send.

### Write a draft yourself Copy Anchor Link

/opportunities/draft saves the text you send, with no model and no credit. Send expectedRevision: 0 to write the first draft of a card that has none: a post you started with Start conversation , or a Radar or Discovery find nobody drafted yet. The save creates revision 1; send the revision you read for every later edit. A conversation that is not Reddit work yet (no post or reply) has nothing to save into and returns an error.

Typed text takes Reddit's own limits: a comment or reply up to 10,000 characters, a post title up to 300 (one line) and a post body up to 40,000. An over-long text returns agentic\_invalid\_input with the limit in the message. The AI's own drafts stay shorter.

### Start a conversation Copy Anchor Link

Start conversation opens a new inbox conversation from a prompt, like typing in New. A Reddit post or comment link becomes a reply card: Rankhog reads the thread and prepares it. Any other prompt becomes a conversation with the agent.

curl

"

$RANKHOG\_API\_BASE\_URL

/agent/v1/conversations"

\\

-H

"Authorization: Bearer

$RANKHOG\_API\_KEY

"

\\

-H

"Content-Type: application/json"

\\

--data

'\{

"organizationId": "org\_...",

"websiteId": "web\_...",

"managedRedditAccountId": "acct\_...",

"prompt": "https://www.reddit.com/r/SaaS/comments/abc123/how\_do\_you\_find\_first\_users/",

"idempotencyKey": "start-001"

\}'

The response returns opportunityId , conversationId , the kind ( reddit\_comment , reddit\_reply , or user\_request ) and the outcome . existing means the thread already had a card, and the prompt was added there. Then read the conversation with get\_opportunity\_conversation .

Needs rankhog:read and conversation:write . Limited to 30 starts per actor and product per hour.

You may pass your own opportunityId and conversationId (uppercase ULIDs). Sending them again with the same prompt returns the same result; any other use returns agentic\_idempotency\_conflict .

An API key starts the conversation, but the agent does not write a draft for it: drafts cost credits and need a person on the team. Autopilot never sends a started conversation; confirm it yourself.

### Start a post Copy Anchor Link

Add post to start a new post in a community you pick, with no link and no model turn:

curl

"

$RANKHOG\_API\_BASE\_URL

/agent/v1/conversations"

\\

-H

"Authorization: Bearer

$RANKHOG\_API\_KEY

"

\\

-H

"Content-Type: application/json"

\\

--data

'\{

"organizationId": "org\_...",

"websiteId": "web\_...",

"managedRedditAccountId": "acct\_...",

"post": \{ "subreddit": "SaaS" \},

"idempotencyKey": "start-post-001"

\}'

The opportunity is a reddit\_post titled Post in r/saas from the first read, with its Reddit action and sending account (or the awaiting-account notice) already in place and no submit link yet. prompt is optional here: leave it out and nothing runs and nothing costs. Write the title and body with Update opportunity draft at expectedRevision: 0 , then confirm. With a prompt , a person's session also has the agent draft the post in that community (one draft credit). The same ids and community replay the same result; the same ids with another community return agentic\_idempotency\_conflict . A bad name returns agentic\_invalid\_input .

### Change a post's community Copy Anchor Link

Set opportunity target subreddit moves a post you started to another community until its first confirm:

curl

"

$RANKHOG\_API\_BASE\_URL

/agent/v1/growth/set-opportunity-target-subreddit"

\\

-H

"Authorization: Bearer

$RANKHOG\_API\_KEY

"

\\

-H

"Content-Type: application/json"

\\

--data

'\{

"organizationId": "org\_...",

"websiteId": "web\_...",

"managedRedditAccountId": "acct\_...",

"opportunityId": "opp\_...",

"subreddit": "startups",

"idempotencyKey": "move-post-001"

\}'

It needs reddit:draft:write . The text and revision stay as they are, and an audit verdict from the old community is cleared. A confirmed post, a queued send, a draft still being written, a closed post and any card that is not a post you started return an error ( agentic\_post\_locked or agentic\_conversation\_read\_only ); edit a confirmed post first to take it back. Choosing the same community again changes nothing.

### TypeScript SDK Copy Anchor Link

@rankhog/sdk is a thin typed client generated from this OpenAPI document:

import

\{ createIdempotencyKey, createRankhogClient \}

from

"@rankhog/sdk"

;

const

rankhog

=

createRankhogClient

(\{ apiKey: process.env.

RANKHOG\_API\_KEY

\!

\});

const

\{

items

\}

=

await

rankhog.

post

(

"/agent/v1/opportunities"

, \{

organizationId:

"org\_..."

,

websiteId:

"web\_..."

,

managedRedditAccountId:

"acct\_..."

,

\});

await

rankhog.

post

(

"/agent/v1/opportunities/confirm"

, \{

organizationId:

"org\_..."

,

websiteId:

"web\_..."

,

managedRedditAccountId:

"acct\_..."

,

opportunityId: items\[

0

\]

\!

.id,

idempotencyKey:

createIdempotencyKey

(

"confirm"

),

\});

Request bodies and responses are fully typed per path, and failures throw RankhogApiError with the error code, request id, and Retry-After seconds.

### Errors Copy Anchor Link

Errors use one shape across REST, MCP, and CLI. See the error catalog for every code.

\{

"error"

: \{

"code"

:

"agentic\_missing\_scope"

,

"message"

:

"Missing required scope: reddit:draft:write."

,

"details"

: \{

"missingScopes"

: \[

"reddit:draft:write"

\]

\}

\}

\}

Every REST response includes x-rankhog-request-id when handled by the agentic API. Rate limited responses (429) include Retry-After seconds.

For AI-assisted integration, every docs page is also raw markdown: append .md to its URL, or fetch /llms.txt for the index and /llms-full.txt for everything in one file.

Next: use the CLI for scripts, or MCP for AI clients.

Errors

Look up every agentic API error code with its HTTP status, an example message, and the operations where it can occur.

### On this page

Base URL

Authentication

Discovery and Radar

Quickstart

Credits

Idempotency

Statuses

Safety

Working the Opportunity Inbox

Write a draft yourself

Start a conversation

Start a post

Change a post's community

TypeScript SDK

Errors

[Open API](https://rankhog.com/docs/api)

[Errors Look up every agentic API error code with its HTTP status, an example message, and the operations where it can occur.](https://rankhog.com/docs/api/errors)

[Base URL](https://rankhog.com/docs/api#base-url)

[Authentication](https://rankhog.com/docs/api#authentication)

[Discovery and Radar](https://rankhog.com/docs/api#discovery-and-radar)

[Quickstart](https://rankhog.com/docs/api#quickstart)

[Credits](https://rankhog.com/docs/api#credits)

[Idempotency](https://rankhog.com/docs/api#idempotency)

[Statuses](https://rankhog.com/docs/api#statuses)

[Safety](https://rankhog.com/docs/api#safety)

[Working the Opportunity Inbox](https://rankhog.com/docs/api#working-the-opportunity-inbox)

[Write a draft yourself](https://rankhog.com/docs/api#write-a-draft-yourself)

[Start a conversation](https://rankhog.com/docs/api#start-a-conversation)

[Start a post](https://rankhog.com/docs/api#start-a-post)

[Change a post's community](https://rankhog.com/docs/api#change-a-posts-community)

[TypeScript SDK](https://rankhog.com/docs/api#typescript-sdk)

[Errors](https://rankhog.com/docs/api#errors)

[API reference](https://rankhog.com/docs/api/reference)

[Get credit purchase link](https://rankhog.com/docs/api/reference/get_credit_purchase_link)

[List opportunities](https://rankhog.com/docs/api/reference/list_opportunities)

[Confirm opportunity action](https://rankhog.com/docs/api/reference/confirm_opportunity_action)

[execute Reddit action](https://rankhog.com/docs/api/reference/execute_reddit_action)

[Start warm-up](https://rankhog.com/docs/api/reference/start_warmup)

[Reddit account protection policy](https://rankhog.com/docs/docs/account-protection)

[Start conversation](https://rankhog.com/docs/api/reference/start_conversation)

[Update opportunity draft](https://rankhog.com/docs/api/reference/update_opportunity_draft)

[Set opportunity target subreddit](https://rankhog.com/docs/api/reference/set_opportunity_target_subreddit)

[/llms.txt](https://rankhog.com/llms.txt)

[/llms-full.txt](https://rankhog.com/llms-full.txt)

[CLI](https://rankhog.com/docs/cli)

[MCP](https://rankhog.com/docs/mcp)