Sharksapi.AI - AI Agent API

← Back to Home | Login | Register (Humans)

AI Agent API Documentation

OAuth2 Client Credentials Flow (M2M authentication)

AI agents can register instantly. No email verification needed - get started immediately.

Quick Start: Register → Get Credentials → Get Token → Use API


STEP 1: Register Your Agent

Get OAuth2 credentials instantly:

curl -X POST https://sharksapi.ai/api/v1/agents/register \
  -H "Content-Type: application/json" \
  -d '{
    "agent_name": "My Claude Agent",
    "agent_type": "custom"
  }'

Response (save these credentials!):

{
  "client_id": "agent_abc123xyz...",
  "client_secret": "secret_789def...",
  "token_endpoint": "https://sharksapi.ai/oauth/token",
  "status": "approved"
}

WARNING: Save client_secret immediately. You won't see it again.

STEP 2: Get Access Token

Exchange credentials for a Bearer token (valid 1 year):

curl -X POST https://sharksapi.ai/oauth/token \
  -H "Content-Type: application/json" \
  -d '{
    "grant_type": "client_credentials",
    "client_id": "agent_abc123xyz...",
    "client_secret": "secret_789def..."
  }'

Response:

{"access_token": "eyJ0eX...", "token_type": "Bearer", "expires_in": 31536000}

STEP 3: Use API

Make API requests with your access token:

curl https://sharksapi.ai/api/v1/... \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Available Integrations

Marketing APIs (scopes: marketing:read, marketing:write)

Sales APIs (scopes: sales:read, sales:write)

Office APIs (scopes: office:read, office:write)


STEP 4 (OPTIONAL): Connect to Third-Party Services

Request OAuth connections (requires human authorization):

curl -X POST https://sharksapi.ai/api/v1/agents/{agent_id}/connections/init \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"service": "notion", "callback_email": "owner@email.com"}'

Flow:

  1. Owner receives email with authorization link
  2. Owner clicks link and authorizes service (e.g., logs into Notion)
  3. Service redirects back - connection created automatically
  4. Agent can now use the connection via API

Check Connection Status

curl https://sharksapi.ai/api/v1/agents/{agent_id}/connections/notion/status \
  -H "Authorization: Bearer YOUR_AGENT_TOKEN"

Possible statuses:

List All Connections

curl https://sharksapi.ai/api/v1/agents/{agent_id}/connections \
  -H "Authorization: Bearer YOUR_AGENT_TOKEN"

Resources

Ready to start?

POST to https://sharksapi.ai/api/v1/agents/register with your agent details!