canonical: https://jentic.com/apis/gocd.org/gocd

# GoCD API

Jentic publishes the only available OpenAPI specification for GoCD API, keeping it validated and agent-ready. The GoCD API is the REST surface for ThoughtWorks' open-source continuous-delivery server. It exposes pipelines, pipeline groups, agents, environments, users, security roles, materials, configuration repositories, access tokens, system backups, and health checks. It is the standard interface for triggering deployments, managing build agents, and rotating access credentials in self-hosted GoCD installations.

## For AI agents

Trigger GoCD pipelines, manage build agents and environments, and rotate access tokens. Built for DevOps agents that drive continuous delivery on self-hosted GoCD servers.

## Scope

Does not handle source-control hosting, container registry management, or runtime production monitoring - use for GoCD continuous-delivery operations only.

## Capabilities

- Create or update pipeline definitions and inspect their configuration
- Read pipeline run history to see which builds passed or failed
- Manage build agents and assign them to environments
- Configure pipeline groups and security roles for fine-grained access control
- Trigger or schedule a system backup of the GoCD configuration
- Issue and revoke personal access tokens for human users and integrations

## Use cases

### Pipeline Triggering and Monitoring

DevOps teams call GET `/admin/pipelines` to inspect a pipeline definition and GET `/pipelines/{pipeline_name}/history` to read recent runs. The pipeline detail and history endpoints together let an agent decide whether to trigger a redeploy after a failed run or roll back to the previous successful build.

Example prompt: Pull the last 5 runs of pipeline 'release-backend' and trigger a new run if the most recent run failed.

### Build Agent Fleet Management

Operations teams use the /agents endpoints to register, retire, or assign build agents to specific environments via `/admin/environments.` This keeps build capacity aligned with workload, particularly when scaling agents up or down on demand.

Example prompt: List all GoCD agents tagged 'gpu-builds', remove any that have been offline for more than 24 hours, and report the result to Slack.

### Access Token and Backup Hygiene

Security and platform teams rotate personal access tokens via /access_tokens and trigger configuration backups through `/admin/backup.` The backup endpoint returns a job that captures the GoCD configuration so it can be restored after a server failure or migration.

Example prompt: Revoke every GoCD access token older than 90 days and trigger a configuration backup.

### AI Agent CI/CD Operations

An AI agent uses Jentic to drive deployments end-to-end: it lists pipelines, checks history, triggers a build, and posts the outcome to a chat channel. Bearer credentials stay in your Jentic One instance and the agent only ever sees schema-level metadata.

Example prompt: Search Jentic for 'trigger gocd pipeline', load the schema, and trigger pipeline 'release-frontend' with the latest material revision.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/admin/pipelines` | List pipeline definitions |
| GET | `/admin/pipelines/{pipeline_name}` | Read a pipeline definition |
| GET | `/pipelines/{pipeline_name}/history` | Get pipeline run history |
| GET | `/agents` | List build agents |
| GET | `/admin/environments` | List environments |
| POST | `/access_tokens` | Create a personal access token |
| POST | `/admin/backup` | Trigger a configuration backup |
| GET | `/health` | Check server health |

## Key resources

- **Pipelines** — Read, create, and update pipeline definitions
- **Pipeline Groups** — Group pipelines for access control and organisation
- **Agents** — Manage build agents and their environments
- **Environments** — Group agents and pipelines by deployment target
- **Users** — Read and update GoCD user records
- **Security Roles** — Configure RBAC roles for users and groups
- **Access Tokens** — Issue and revoke personal access tokens
- **Backup** — Trigger configuration backups
- **Materials** — Inspect SCM and other material definitions

## Why Jentic

- **Setup:** Wiring GoCD by hand means pointing at your own {gocd-server} host, choosing between bearer token and basic auth, and mapping the pipeline, agent, and environment admin endpoints yourself. Through Jentic you install once, import GoCD from the API Directory, store the credential once, and your agent calls it.
- **Permission scoping:** GoCD puts the pipeline name in the URL path (`/pipelines/{pipeline_name}/history`), so a rule can pin your agent to one pipeline: it can read that pipeline's history and configuration and nothing else. You choose the operations it may call, so administrative ones like creating a backup or issuing access tokens are not included unless you add them.
- **Credential handling:** Your GoCD token or basic-auth credential is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'list gocd pipelines' or 'check agent status', and Jentic returns the matching GoCD operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **CircleCI API** — CircleCI is a hosted CI/CD platform with similar pipeline and job concepts but no self-hosted control plane.
- **GitHub REST API** — GitHub holds the source repositories that GoCD pipelines pull as materials.
- **Buildkite API** — Buildkite offers a hybrid model with hosted control plane and customer-owned agents.

## FAQ

### Why is there no official OpenAPI spec for GoCD API?

GoCD documents its REST endpoints in HTML reference pages but does not publish a maintained OpenAPI specification. Jentic generates and maintains this spec so AI agents and developers can call GoCD API via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the GoCD API use?

GoCD supports two schemes: HTTP bearer tokens (personal access tokens) and HTTP basic authentication for local users. Through Jentic, both are stored encrypted in the vault and injected at execution time so the agent never sees the raw secret.

### Can I list pipeline run history with the GoCD API?

Yes. GET `/pipelines/{pipeline_name}/history` returns the recent run history for a named pipeline, including status and material revisions, so an agent can detect failures and decide on retries.

### What are the rate limits for the GoCD API?

GoCD is self-hosted and the OpenAPI spec does not declare a numeric rate limit. The practical limit depends on the deployed server's capacity; back off on HTTP 429 responses if your administrator has fronted the server with a rate-limiting proxy.

### How do I trigger a GoCD pipeline through Jentic?

Run a Jentic search for 'trigger gocd pipeline', load the schema for the relevant `/admin/pipelines` or scheduling endpoint, and execute it with the pipeline name. Install with pip install jentic and chain search, load, and execute.

### Does the GoCD API support config backups?

Yes. POST `/admin/backup` triggers a configuration backup. The endpoint returns a job that captures the GoCD configuration so it can be restored after a server failure or migration.

### Can I limit what my agent is allowed to do with the GoCD API?

Yes. Because Jentic One is self-hosted, your own rules decide which GoCD operations and credentials the agent may use. GoCD puts the pipeline name in the URL path, such as GET `/pipelines/{pipeline_name}/history`, so you can pin the agent to a single pipeline and let it read only that pipeline's history and configuration. You choose the operations it can call, so administrative ones like POST `/admin/backup` or issuing access tokens via /access_tokens stay off limits unless you add them.
