Optimly Developer Documentation

Agent API

Optimly Agent API

In short

Connect a custom agent harness to Optimly's versioned, brand-scoped API.

The Optimly Agent API is the versioned interface for custom agent harnesses. It exposes the same brand-scoped evidence and governed actions as Optimly MCP without requiring an MCP client.

Not sure whether the API is the right interface? Compare MCP, the Agent API, and the Optimly Agent in Slack.

The latest REST API is v1. Work-management operations currently use a separate governed contract version, 3.0.0. The work contract version does not change the REST base URL to v3.

Base URL

https://app.optimly.ai/api/v1/agent

The API requires paid access. Optimly Platform provides read and non-action capabilities. Governed action workflows require the AI Brand Execution Program, the relevant brand permissions, and explicit approval. Keys are scoped to one organization and brand; free accounts cannot generate or use Agent API or MCP credentials.

Follow the agent-assisted access, payment, authorization, and verification flow.

Authenticate

Send the selected brand's osk_ key in the X-API-Key header:

X-API-Key: osk_your_brand_scoped_key

Store the key in an encrypted secret manager or managed egress gateway. Never print, inspect, log, or place it in browser code. A worker that serves multiple clients must resolve the credential from the active client context, not from a shared core-worker slot.

Discover capabilities first

Every run begins with capability discovery:

curl https://app.optimly.ai/api/v1/agent/capabilities \
  -H "X-API-Key: $OPTIMLY_API_KEY"

Confirm the returned organization and brand before continuing. Treat the returned capability, method, and endpoint records as the contract for that credential. Do not hard-code an operation that is not advertised and do not switch to another client's credential after a denial.

The synchronized complete capability contract is:

CapabilityMethods and pathAccessSide effectMCP tools
brand.readGET /api/v1/agent/brand-vaultfree; read_brandnonebrand_status, brand_vault_profile
reports.readGET, PATCH /api/v1/agent/brand-vaultsignal_pro; read_reportsnonedelta_report, delta_report_details, delta_report_history, brand_sources, competitive_analysis, brand_monitor, brand_publication_match, get_whitespace_candidates, get_retrieval_opportunities
whitespace.managePATCH /api/v1/agent/brand-vault/whitespace-candidates/:candidateId/statussignal_pro; write_brandmutationupdate_candidate_status
evidence.readGET /api/v1/agent/evidencefree; read_brandnoneget_ai_representation, get_site_retrievals, get_site_readiness, get_actions, get_attribution_evidence
website.readGET, POST /api/v1/agent/websitesignal_pro; read_reportsnoneinspect_website, get_agent_activity, get_agent_content_gaps, inspect_agent_view, simulate_agent_preview
website-analytics.readGET /api/v1/agent/website-analytics/installationenterprise; read_reportsnoneget_website_analytics_installation, get_website_analytics_installation_status
website-analytics.installPOST /api/v1/agent/website-analytics/installationenterprise; write_brandmutationprepare_website_analytics_installation, activate_website_analytics
research.guidancePOST /api/v1/agent/research/guidancesignal_pro; read_reportsnoneget_recommendation_guidance
work.readGET /api/v1/agent/workenterprise; view_actionsnoneget_agent_work, get_agent_work_changes, get_agent_work_context, get_work_status
work.managePOST, PATCH /api/v1/agent/workenterprise; record_actionsmutationsave_recommendation, save_draft, record_agent_feedback, record_checklist_progress, request_customer_input, record_customer_response, record_work_verification, record_work_outcome, assign_recommendation, start_recommendation, dismiss_recommendation, preview_recommendation_adaptation, confirm_recommendation_adaptation, discard_recommendation_adaptation, record_customer_completion, verify_recommendation_now, submit_recommendation_implementation
actions.readGET /api/v1/agent/operationsenterprise; view_actionsnoneget_action_status, list_pending_approvals, check_action_idempotency
actions.proposePOST /api/v1/agent/operations/actionsenterprise; record_actionsproposalcreate_execution_action, create_brand_vault_publish_action
actions.executePOST /api/v1/agent/operations/actions/:actionId/transitionenterprise; record_actionsmutationtransition_execution_action
approvals.requestPOST /api/v1/agent/operations/approvals/requestenterprise; request_approvalsapprovalrequest_action_approval
approvals.decidePOST /api/v1/agent/operations/approvals/:approvalId/decisionenterprise; record_approval_decisionsapprovalrecord_approval_decision
brand.correctPOST /api/v1/agent/brand-vault/update-sectionfree; execute_brand_vault_actionsmutationbrand_update
brand.publishPOST /api/v1/agent/brand-vault/publishenterprise; execute_brand_vault_actionsmutationbrand_update, brand_publish
coverage.manageGET, POST /api/v1/agent/coverageenterprise; manage_brand_vaultmutationcoverage_list, coverage_add, coverage_add_many

The actual /capabilities response is authoritative. Availability varies by plan, permissions, and brand configuration.

To inspect the complete tenant-free contract without a credential, use the public schema:

curl https://app.optimly.ai/api/v1/agent/schema

The current schema contains 18 capabilities mapped to 61 API-backed MCP tool names. The Scout MCP server also exposes customer discovery, consumer, experiment, and administrative tools that do not have one-to-one Agent API endpoints.

Read safely

Choose an advertised operation with no side effect and call the returned method and path. Reads remain constrained to the organization and brand resolved from the credential. Never accept a caller-supplied tenant identifier as a way to escape that scope.

Handle failures

StatusMeaningRequired behavior
401Missing, invalid, expired, or revoked keyStop and repair the selected client's credential
403Plan, permission, approval, or mutation envelope is insufficientDo not bypass governance or retry as another client
409Action state or idempotency conflictRead the existing action and reconcile before retrying
429Request limit reachedHonor retry guidance and back off

Do not fall back to MCP when an Agent API capability is absent. Failing clearly preserves the credential, capability, and governance boundaries the caller expects.

Execute mutations through governance

A correction, publish, website update, or off-site action requires an immutable proposal, explicit approval, a complete mutation envelope, and a stable idempotency key. Authentication by itself never authorizes a mutation.

Follow the governed Agent Actions workflow