Templates
Create, update, and validate pipeline, stage, and step templates with the Harness Templates API.
The Templates API manages the reusable pipeline, stage, and step templates that teams share across projects.
Request basics
API key token: Send it in the
x-api-keyheader on every request. Go to Manage API keys to create a key and token.Account, organization, and project IDs: Send
accountIdentifieras a query parameter on every request. AddorgIdentifierandprojectIdentifierfor templates that live in an organization or project. Go to Organizations and projects to find these identifiers.Base URL: Send requests to
https://app.harness.io/gateway/template/api, followed by the endpoint path.
Example request
List the stable versions of the templates in a project:
curl -X POST "https://app.harness.io/gateway/template/api/templates/list-metadata?accountIdentifier=ACCOUNT_ID&orgIdentifier=ORG_ID&projectIdentifier=PROJECT_ID&templateListType=Stable" \
-H "x-api-key: $HARNESS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"filterType": "Template"}'Replace ACCOUNT_ID, ORG_ID, and PROJECT_ID with your own values, and set HARNESS_API_KEY to your API key token.
Find an endpoint
Endpoint paths are relative to the base URL.
Templates: Versioned definitions of a pipeline, stage, step, or step group that other pipelines reference and inherit changes from. List templates with
POST /templates/list-metadata, read one withGET /templates/{templateIdentifier}, and create one withPOST /templates. Go to Templates overview to understand how templates work.Template validation: Checks that a template's inputs still match the pipelines that use it, and updates them when they drift. Check a YAML's template inputs with
GET /refresh-template/validate-template-inputs, and get the updated YAML withPOST /refresh-template/refreshed-yaml. Go to Use a template to use a template in a pipeline.Template filters: Saved searches for finding templates by type, scope, or tag. List saved filters with
GET /filters. Go to Templates to find templates.
Last updated
Was this helpful?