{ "openapi": "3.0.3", "info": { "title": "Agenty API", "version": "1.0.0", "description": "Agenty is a cloud-based web scraping, data extraction, and automation platform. The API allows you to manage scraping agents, run scraping jobs, and retrieve extracted data programmatically.", "x-jentic-source-url": "https://agenty.com/docs/api", "contact": {} }, "servers": [ { "url": "https://api.agenty.com/v2", "description": "Agenty API v2" } ], "paths": { "/agents": { "get": { "operationId": "listAgents", "tags": [ "Agents" ], "summary": "List all agents", "description": "Returns a paginated list of all scraping agents in the account.", "parameters": [ { "name": "page", "in": "query", "schema": { "type": "integer", "default": 1 } }, { "name": "pageSize", "in": "query", "schema": { "type": "integer", "default": 20 } }, { "name": "type", "in": "query", "schema": { "type": "string", "enum": [ "scraping", "monitoring", "change-detection" ] }, "description": "Filter by agent type" } ], "responses": { "200": { "description": "List of agents", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AgentListResponse" } } } }, "401": { "description": "Unauthorized - invalid API key", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/agents/{agentId}": { "get": { "operationId": "getAgent", "tags": [ "Agents" ], "summary": "Get an agent", "description": "Returns details of a specific scraping agent.", "parameters": [ { "name": "agentId", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Agent details", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Agent" } } } }, "401": { "description": "Unauthorized - invalid API key", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Agent or job not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/agents/{agentId}/run": { "post": { "operationId": "runAgent", "tags": [ "Jobs" ], "summary": "Run an agent", "description": "Start a new scraping job for the specified agent. Returns the job details.", "parameters": [ { "name": "agentId", "in": "path", "required": true, "schema": { "type": "string" } } ], "requestBody": { "required": false, "content": { "application/json": { "schema": { "type": "object", "properties": { "urls": { "type": "array", "items": { "type": "string" }, "description": "Override URLs for this run" }, "config": { "type": "object", "description": "Override agent configuration for this run" } } } } } }, "responses": { "200": { "description": "Job started", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Job" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized - invalid API key", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Agent or job not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/agents/{agentId}/jobs": { "get": { "operationId": "listAgentJobs", "tags": [ "Jobs" ], "summary": "List jobs for an agent", "description": "Returns a paginated list of jobs for the specified agent.", "parameters": [ { "name": "agentId", "in": "path", "required": true, "schema": { "type": "string" } }, { "name": "page", "in": "query", "schema": { "type": "integer", "default": 1 } }, { "name": "pageSize", "in": "query", "schema": { "type": "integer", "default": 20 } }, { "name": "status", "in": "query", "schema": { "type": "string", "enum": [ "running", "completed", "failed", "stopped" ] } } ], "responses": { "200": { "description": "List of jobs", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobListResponse" } } } }, "401": { "description": "Unauthorized - invalid API key", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Agent or job not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/jobs/{jobId}": { "get": { "operationId": "getJob", "tags": [ "Jobs" ], "summary": "Get a job", "description": "Returns details and status of a specific scraping job.", "parameters": [ { "name": "jobId", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Job details", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Job" } } } }, "401": { "description": "Unauthorized - invalid API key", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Agent or job not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/jobs/{jobId}/stop": { "post": { "operationId": "stopJob", "tags": [ "Jobs" ], "summary": "Stop a running job", "description": "Stop a currently running scraping job.", "parameters": [ { "name": "jobId", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Job stopped", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Job" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized - invalid API key", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Agent or job not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/jobs/{jobId}/result": { "get": { "operationId": "getJobResult", "tags": [ "Jobs" ], "summary": "Get job results", "description": "Returns the scraped data from a completed job.", "parameters": [ { "name": "jobId", "in": "path", "required": true, "schema": { "type": "string" } }, { "name": "page", "in": "query", "schema": { "type": "integer", "default": 1 } }, { "name": "pageSize", "in": "query", "schema": { "type": "integer", "default": 100 } }, { "name": "format", "in": "query", "schema": { "type": "string", "enum": [ "json", "csv", "xml" ], "default": "json" }, "description": "Output format" } ], "responses": { "200": { "description": "Scraped data results", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobResultResponse" } } } }, "401": { "description": "Unauthorized - invalid API key", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Agent or job not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } } }, "components": { "securitySchemes": { "apiKey": { "type": "apiKey", "name": "Authorization", "in": "header", "description": "Agenty API key: 'Bearer {api_key}'" } }, "schemas": { "Agent": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "type": "string", "enum": [ "scraping", "monitoring", "change-detection" ] }, "status": { "type": "string" }, "urls": { "type": "array", "items": { "type": "string" } }, "config": { "type": "object", "description": "Agent configuration including selectors and settings" }, "schedule": { "type": "string", "nullable": true, "description": "Cron schedule expression" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" }, "last_run_at": { "type": "string", "format": "date-time", "nullable": true } } }, "AgentListResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Agent" } }, "total": { "type": "integer" }, "page": { "type": "integer" }, "pageSize": { "type": "integer" } } }, "Job": { "type": "object", "properties": { "id": { "type": "string" }, "agentId": { "type": "string" }, "status": { "type": "string", "enum": [ "running", "completed", "failed", "stopped" ] }, "total_urls": { "type": "integer" }, "completed_urls": { "type": "integer" }, "failed_urls": { "type": "integer" }, "total_records": { "type": "integer" }, "started_at": { "type": "string", "format": "date-time" }, "completed_at": { "type": "string", "format": "date-time", "nullable": true }, "error": { "type": "string", "nullable": true } } }, "JobListResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Job" } }, "total": { "type": "integer" }, "page": { "type": "integer" }, "pageSize": { "type": "integer" } } }, "JobResultResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object" }, "description": "Extracted data records" }, "total": { "type": "integer" }, "page": { "type": "integer" }, "pageSize": { "type": "integer" } } }, "ErrorResponse": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } } } } }, "security": [ { "apiKey": [] } ], "tags": [ { "name": "Agents", "description": "Manage scraping agents" }, { "name": "Jobs", "description": "Manage scraping jobs and results" } ] }