Skip to main content

API Overview

The Jataka API provides programmatic access to all platform features including Governor limit monitoring, test execution, and dependency analysis.

Authentication

Jataka uses OAuth 2.0 for authentication. You’ll need an API token to make requests.

Getting Your API Token

1
Login to your Jataka account at app.jataka.io
2
Navigate to Settings → API Keys
3
Click Generate New API Key
4
Copy the token and store it securely

Using the API Token

Include the token in the Authorization header:
curl -H "Authorization: Bearer YOUR_API_TOKEN" \
     https://api.jataka.io/v1/limits

Rate Limits

PlanRequests per HourConcurrent Requests
Team1,00010
Enterprise10,00050
CustomUnlimited100

Base URL

https://api.jataka.io/v1

Core Endpoints

Limits

Get real-time Governor limit information:
GET /v1/limits
Response:
{
  "limits": {
    "soql_queries": {
      "used": 45,
      "max": 100,
      "percentage": 45,
      "status": "normal"
    },
    "dml_statements": {
      "used": 23,
      "max": 150,
      "percentage": 15,
      "status": "normal"
    },
    "cpu_time": {
      "used": 2340,
      "max": 10000,
      "percentage": 23,
      "status": "normal"
    }
  },
  "timestamp": "2026-04-03T12:00:00Z",
  "org_id": "00Dxx00000000001"
}

Test Execution

Run automated tests:
POST /v1/tests
Request Body:
{
  "engines": ["api_firewall", "kamikaze_pods"],
  "scenarios": ["create_opportunity", "bulk_update"],
  "thresholds": {
    "soql_queries": 80,
    "dml_statements": 120
  },
  "options": {
    "parallel": true,
    "timeout": 300,
    "fail_on_critical": true
  }
}
Response:
{
  "test_id": "test_abc123",
  "status": "running",
  "started_at": "2026-04-03T12:00:00Z",
  "estimated_duration": 120,
  "engines": [
    {
      "name": "api_firewall",
      "status": "running",
      "progress": 45
    },
    {
      "name": "kamikaze_pods", 
      "status": "pending",
      "progress": 0
    }
  ]
}

Test Results

Get test results:
GET /v1/tests/{test_id}/results
Response:
{
  "test_id": "test_abc123",
  "status": "completed",
  "duration": 95,
  "summary": {
    "total": 15,
    "passed": 13,
    "failed": 2,
    "warnings": 3
  },
  "results": [
    {
      "engine": "api_firewall",
      "scenario": "create_opportunity",
      "status": "passed",
      "limits": {
        "soql_queries": 12,
        "dml_statements": 5,
        "cpu_time": 1234
      },
      "issues": []
    },
    {
      "engine": "api_firewall",
      "scenario": "bulk_update",
      "status": "failed",
      "limits": {
        "soql_queries": 101,
        "dml_statements": 45,
        "cpu_time": 5678
      },
      "issues": [
        {
          "type": "soql_limit_exceeded",
          "severity": "critical",
          "message": "SOQL queries exceeded limit: 101/100",
          "file": "classes/AccountTrigger.cls",
          "line": 42,
          "recommendation": "Move SOQL query outside of for loop"
        }
      ]
    }
  ]
}

Dependency Analysis

Get Dependencies

Analyze object dependencies:
GET /v1/dependencies/{object_name}
Response:
{
  "object": "Account",
  "dependencies": {
    "incoming": [
      {
        "object": "Opportunity",
        "field": "AccountId",
        "type": "lookup",
        "impact": "high"
      },
      {
        "object": "Contact",
        "field": "AccountId", 
        "type": "master-detail",
        "impact": "critical"
      }
    ],
    "outgoing": [
      {
        "object": "User",
        "field": "OwnerId",
        "type": "lookup",
        "impact": "low"
      }
    ]
  },
  "blast_radius": {
    "records_affected": 50000,
    "objects_affected": 12,
    "risk_score": 8.5
  }
}

Blast Radius Prediction

Predict impact of code changes:
POST /v1/blast-radius
Request Body:
{
  "changes": [
    {
      "file": "classes/AccountTrigger.cls",
      "type": "apex_class",
      "operations": ["update", "delete"]
    },
    {
      "file": "objects/Account__c.fields/Custom_Field__c.field",
      "type": "custom_field",
      "operations": ["create"]
    }
  ]
}
Response:
{
  "analysis": {
    "total_records_affected": 75000,
    "objects_affected": 15,
    "risk_score": 7.8,
    "estimated_test_time": 180
  },
  "affected_objects": [
    {
      "name": "Account",
      "records": 50000,
      "impact": "high",
      "reason": "Direct trigger modification"
    },
    {
      "name": "Opportunity",
      "records": 25000,
      "impact": "medium",
      "reason": "Rollup summary fields affected"
    }
  ],
  "recommendations": [
    "Run tests in sandbox first",
    "Schedule deployment during low-traffic hours",
    "Monitor performance metrics post-deployment"
  ]
}

Webhooks

Configure Webhooks

Set up webhooks to receive real-time notifications:
POST /v1/webhooks
Request Body:
{
  "url": "https://your-app.com/webhook",
  "events": [
    "test.completed",
    "limit.threshold_exceeded",
    "dependency.changed"
  ],
  "secret": "your_webhook_secret",
  "active": true
}

Webhook Payload Example

{
  "event": "test.completed",
  "timestamp": "2026-04-03T12:00:00Z",
  "data": {
    "test_id": "test_abc123",
    "status": "failed",
    "critical_issues": 2,
    "repository": "my-org/my-repo",
    "pr_number": 123
  }
}

SDK Examples

JavaScript/Node.js

const JatakaAPI = require('@jataka/api');

const client = new JatakaAPI({
  apiKey: 'YOUR_API_TOKEN',
  baseURL: 'https://api.jataka.io/v1'
});

// Get current limits
async function getLimits() {
  try {
    const limits = await client.limits.get();
    console.log('SOQL usage:', limits.soql_queries.percentage + '%');
  } catch (error) {
    console.error('Error:', error.message);
  }
}

// Run tests
async function runTests() {
  const test = await client.tests.create({
    engines: ['api_firewall'],
    scenarios: ['create_opportunity']
  });
  
  console.log('Test ID:', test.test_id);
  
  // Poll for results
  const results = await client.tests.getResults(test.test_id);
  console.log('Results:', results.summary);
}

Python

import requests
import json

class JatakaAPI:
    def __init__(self, api_token):
        self.base_url = "https://api.jataka.io/v1"
        self.headers = {
            "Authorization": f"Bearer {api_token}",
            "Content-Type": "application/json"
        }
    
    def get_limits(self):
        response = requests.get(
            f"{self.base_url}/limits",
            headers=self.headers
        )
        return response.json()
    
    def run_test(self, engines, scenarios):
        payload = {
            "engines": engines,
            "scenarios": scenarios
        }
        response = requests.post(
            f"{self.base_url}/tests",
            headers=self.headers,
            json=payload
        )
        return response.json()

# Usage
api = JatakaAPI("YOUR_API_TOKEN")
limits = api.get_limits()
print(f"SOQL Usage: {limits['limits']['soql_queries']['percentage']}%")

cURL Examples

# Get limits
curl -H "Authorization: Bearer YOUR_API_TOKEN" \
     https://api.jataka.io/v1/limits

# Run test
curl -X POST \
     -H "Authorization: Bearer YOUR_API_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"engines": ["api_firewall"], "scenarios": ["create_opportunity"]}' \
     https://api.jataka.io/v1/tests

# Get dependencies
curl -H "Authorization: Bearer YOUR_API_TOKEN" \
     https://api.jataka.io/v1/dependencies/Account

Error Handling

Error Response Format

{
  "error": {
    "code": "INVALID_THRESHOLD",
    "message": "SOQL threshold must be between 1-100",
    "details": {
      "field": "thresholds.soql_queries",
      "value": 150,
      "valid_range": "1-100"
    },
    "request_id": "req_xyz789"
  }
}

Common Error Codes

CodeDescriptionHTTP Status
UNAUTHORIZEDInvalid or missing API token401
FORBIDDENInsufficient permissions403
INVALID_THRESHOLDInvalid threshold value400
TEST_TIMEOUTTest execution timed out408
ORG_NOT_FOUNDSalesforce org not connected404
RATE_LIMIT_EXCEEDEDAPI rate limit exceeded429

Best Practices

Use Webhooks: Instead of polling for test results, set up webhooks for real-time notifications.
Handle Timeouts: Always implement timeout handling for long-running operations.
Cache Results: Cache dependency analysis results to reduce API calls.

What’s Next?

Try the API: Use our Postman collection to explore the API interactively.