Skip to main content

Organizations API

Base URL: /api/organization

All organization endpoints require authentication via Authorization: Bearer <token>.


GET /api/organization​

Get current organization details.

Auth: All roles

Response (200 OK)​

{
"success": true,
"organization": {
"id": "507f191e810c19729de860ea",
"name": "Acme Corp",
"slug": "acme-corp",
"plan": "free",
"limits": {
"maxProjects": 1,
"maxHostedRuns": 0,
"maxExternalRuns": 250,
"maxTestRuns": 0,
"retentionDays": 7,
"maxUsers": 3,
"maxConcurrentRuns": 1,
"maxStorageBytes": 1073741824,
"currentStorageUsedBytes": 0
},
"userCount": 2,
"userLimit": 3,
"aiAnalysisEnabled": true,
"entitlements": {
"externalCi": true, "stability": true, "testCases": true, "testCycles": true,
"testCaseImportExport": true, "aiFeatures": true, "issueTrackers": false,
"quarantineAndReleaseGate": false, "smartPr": false, "hostedExecution": false,
"publicApiAndMcp": false, "automationPlanner": false, "auditLogs": false, "sso": false
},
"activeEntitlements": { "testCases": true, "hostedExecution": false, "...": "…" },
"entitlementOverrides": {},
"requiredPlans": { "issueTrackers": "starter", "automationPlanner": "team", "auditLogs": "business", "sso": "enterprise", "...": "…" },
"createdAt": "2026-01-15T10:00:00.000Z"
}
}

Entitlements: entitlements is what your plan (or an exception set by the Agnox team, listed in entitlementOverrides) includes; activeEntitlements is that and your own switch where the feature has one (Test Cases, Test Cycles, External CI / Agnox Hosted, Smart PR, Automation Planner). requiredPlans names the lowest plan of each capability. GET /api/auth/me returns the same fields under organization.

Limits: maxHostedRuns is the monthly Agnox Hosted Runs quota and maxExternalRuns the monthly External CI Runs quota (both reset on the 1st of each calendar month). retentionDays is your plan's history retention (7 / 14 / 30 / 90). maxTestRuns is a deprecated alias of maxHostedRuns, kept for backward compatibility — don't use it in new integrations.


PATCH /api/organization​

Update organization settings.

Auth: Admin only

Request Body​

{
"name": "New Organization Name",
"aiAnalysisEnabled": false
}
FieldTypeDescription
namestringOrganization name (2–100 characters)
aiAnalysisEnabledbooleanEnable/disable AI failure analysis

Response (200 OK)​

{
"success": true,
"message": "Organization settings updated successfully",
"organization": { "id": "...", "name": "New Name", "aiAnalysisEnabled": false }
}

All settings changes are logged to the audit_logs collection.


GET /api/organization/usage​

Get usage statistics for the current billing period.

Auth: All roles

Response (200 OK)​

{
"success": true,
"usage": {
"currentPeriod": {
"startDate": "2026-02-01T00:00:00.000Z",
"endDate": "2026-02-28T23:59:59.999Z"
},
"hostedRuns": { "used": 6, "limit": 75, "percentUsed": 8 },
"externalRuns": { "used": 45, "limit": 1500, "percentUsed": 3 },
"testRuns": { "used": 6, "limit": 75, "percentUsed": 8 },
"users": { "active": 2, "limit": 3 },
"storage": { "usedBytes": 524288000, "limitBytes": 10737418240 }
},
"alerts": [
{
"type": "warning",
"resource": "hostedRuns",
"message": "You've used 80% of your monthly hosted runs",
"percentUsed": 80
}
]
}

hostedRuns counts runs executed in an Agnox container, externalRuns runs reported by @agnox/playwright-reporter; each has its own monthly limit. testRuns is a deprecated alias of hostedRuns. A limit of -1 means unlimited.

Alert Types​

TypeTrigger
info50–79% of limit used
warning80–99% of limit used
critical100% reached

GET /api/organization/ai-config​

Get AI configuration (model selection and BYOK status).

Auth: All roles


PATCH /api/organization/ai-config​

Update AI configuration (default model, BYOK keys).

Auth: Admin only


GET /api/organization/webhook-secret​

Reports whether a PR webhook secret is configured. The secret itself is never returned.

Auth: Admin only

Response (200 OK)​

{
"success": true,
"data": { "configured": true, "rotatedAt": "2026-11-09T12:00:00.000Z" }
}

POST /api/organization/webhook-secret​

Generates or rotates the PR webhook secret. The plaintext is returned only in this response, and the previous secret stops working immediately.

Auth: Admin only

Response (200 OK)​

{
"success": true,
"data": { "secret": "<64 hex characters>", "rotatedAt": "2026-11-09T12:00:00.000Z" }
}

GET /api/integrations/linear​

Get current Linear integration status for the organization.

Auth: All roles

Response (200 OK)​

{
"success": true,
"data": {
"enabled": true,
"teamId": "TEAM-abc123"
}
}

The stored API key is never returned in plaintext. enabled is true once a valid key has been saved.


PUT /api/integrations/linear​

Store or update the Linear API key and team ID.

Auth: Admin only

Request Body​

{
"apiKey": "lin_api_...",
"teamId": "TEAM-abc123"
}

The apiKey is encrypted at rest using AES-256-GCM before being stored. Setting enabled: false explicitly disables the integration without removing the stored credentials.

Response (200 OK)​

{
"success": true,
"message": "Linear integration saved successfully"
}

GET /api/integrations/monday​

Get current Monday.com integration status.

Auth: All roles

Response (200 OK)​

{
"success": true,
"data": {
"enabled": true,
"boardId": "12345678",
"groupId": "topics"
}
}

PUT /api/integrations/monday​

Store or update the Monday.com API token, board ID, and optional group ID.

Auth: Admin only

Request Body​

{
"apiKey": "eyJhbGciOiJIUzI1NiJ9...",
"boardId": "12345678",
"groupId": "topics"
}

GET /api/integrations/monday/form-metadata​

Fields for the per-item form of the Create Item modal: the writable columns and groups of the organization's saved board, plus the saved defaults. Always uses the saved board ID and encrypted token; nothing in the request can change them.

Auth: Admin, Developer (the roles that may create items)

Response (200 OK)​

{
"success": true,
"data": {
"boardId": "12345678",
"boardName": "QA Board",
"columns": [
{ "id": "status", "title": "Status", "type": "status", "writable": true, "labels": [{ "id": "1", "label": "Bug" }] },
{ "id": "text_env", "title": "Environment", "type": "text", "writable": true }
],
"groups": [{ "id": "topics", "title": "Bugs" }],
"assignees": [{ "id": 123, "name": "Dana Levi", "kind": "person", "email": "dana@example.com" }],
"defaultGroupId": "topics",
"defaultColumnValues": { "status": { "label": "Bug" } }
}
}

assignees are the people and teams for people columns; empty when the board has no such column or the token may not list them.

404 when the integration is not configured or disabled. Admins can preview any board (including read-only columns) with POST /api/integrations/monday/board-metadata.


POST /api/monday/items​

Create a Monday.com board item from an execution.

Auth: Admin, Developer

Request Body​

{
"executionId": "execution-task-id",
"title": "Login test fails on staging",
"description": "Markdown description, posted as an update",
"groupId": "new_group12345",
"columnValues": { "status": { "label": "Regression" }, "text_env": null }
}

groupId and columnValues are optional. columnValues is merged over the saved default column values (its keys win; null drops a default for this item) and follows the same rules (JSON object keyed by column ID, 16 KB at most after merging).

Response (201 Created)​

{
"success": true,
"data": {
"id": "987654321",
"url": "https://myteam.monday.com/boards/12345678/pulses/987654321"
}
}

url is the workspace link to the item; it is omitted when Monday.com returns none and the account slug cannot be read. warning is added when the item was created but its description could not be posted. The item ID and URL are linked to the execution and shown in its details.


DELETE /api/integrations/:provider​

Unlink an integration by removing its stored credentials from the organization.

Auth: Admin only

Supported providers: github, gitlab, azuredevops, bitbucket, jira, linear, monday, slack

Response (200 OK)​

{
"success": true,
"message": "Integration unlinked successfully"
}

POST /api/linear/issues​

Create a Linear issue from an execution and record the link bidirectionally.

Auth: All roles (JWT required)

Request Body​

{
"taskId": "execution-task-id",
"title": "Login test fails on staging",
"description": "## Root Cause\n..."
}

Response (201 Created)​

{
"success": true,
"data": {
"issueId": "ABC-123",
"issueUrl": "https://linear.app/myteam/issue/ABC-123"
}
}

The issueId and issueUrl are linked to the execution for bidirectional traceability.


Plan entitlements​

Every capability is checked on the server (plan comparison). A request for one your plan does not include returns:

{
"success": false,
"error": "Issue trackers (Jira, Linear, Monday) is available on the Starter plan and above. Upgrade your plan to use it.",
"code": "ENTITLEMENT_REQUIRED",
"feature": "issueTrackers",
"requiredPlan": "starter",
"requiredPlanName": "Starter",
"message": "Issue trackers (Jira, Linear, Monday) is available on the Starter plan and above. Upgrade your plan to use it."
}
featureLowest planChecked on
issueTrackersStarterSaving and testing Jira / Linear / Monday.com, their project and field lookups, creating tickets and items. Reading the saved settings and DELETE /api/integrations/:provider stay open.
quarantineAndReleaseGateStarterManual quarantine and its governance, turning automatic quarantine / release on, Release Readiness verdict and gate policy. The Stability page and its data stay on Free.
smartPrStarterThe PR webhook (POST /api/webhooks/ci/pr) and switching aiFeatures.prRouting on.
hostedExecutionStarterEvery hosted run (Run Now, CI trigger, schedules, test cycles, v1 POST /executions) and choosing Hosted / Hybrid in onboarding.
publicApiAndMcpStarter/api/v1/* with an API key (and so the MCP server), except POST /api/v1/reports, which is External CI.
automationPlannerTeam/api/ai/automation-planner/*, /api/v1/automation-planner/* (with an API key: Public API too) and switching aiFeatures.automationPlanner on.
auditLogsBusinessGET /api/organization/audit-logs.
ssoEnterpriseSet up with the Agnox team.

A module an admin switched off in Settings → Features returns 403 with code: "FEATURE_DISABLED" (for example every test case route while testCasesEnabled is false; the Stability data and quarantine routes are not part of that module).


GET /api/organization/audit-logs​

Latest administrative actions of the organization, newest first.

Auth: Admin · Plan: Business and above (403 ENTITLEMENT_REQUIRED otherwise)

Query: limit (1–100, default 50), offset (default 0), action (exact match)

{
"success": true,
"data": {
"entries": [
{ "id": "…", "action": "org.features_updated", "userId": "…", "userEmail": null, "targetType": "organization", "targetId": "…", "details": {}, "ip": "203.0.113.7", "timestamp": "2026-12-01T09:00:00.000Z" }
],
"limit": 50,
"offset": 0
}
}