Endpoints relating to contexts. Use contexts to secure and share environment variables.
Creates a new context.
name required | string The user defined name of the context. |
required | object or object |
{- "name": "string",
- "owner": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "type": "organization"
}
}
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "name": "string",
- "created_at": "2015-09-21T17:29:21.042Z"
}
List all contexts for an owner.
owner-id | string <uuid> The unique ID of the owner of the context. Specify either this or owner-slug. |
owner-slug | string A string that represents an organization. Specify either this or owner-id. Cannot be used for accounts. |
owner-type | string Enum: "account" "organization" The type of the owner. Defaults to "organization". Accounts are only used as context owners in server. |
page-token | string A token to retrieve the next page of results. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/context', qs: { 'owner-id': 'c65b68ef-e73b-4bf2-be9a-7a322a9df150', 'page-token': 'NEXT_PAGE_TOKEN' }, headers: {'Circle-Token': 'CIRCLE_TOKEN'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "name": "string",
- "created_at": "2015-09-21T17:29:21.042Z"
}
], - "next_page_token": "string"
}
Returns basic information about a context.
context-id required | string <uuid> ID of the context (UUID) |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/context/%7Bcontext-id%7D', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "name": "string",
- "created_at": "2015-09-21T17:29:21.042Z"
}
context-id required | string <uuid> ID of the context (UUID) |
const request = require('request'); const options = { method: 'DELETE', url: 'https://circleci.com/api/v2/context/%7Bcontext-id%7D', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "message": "string"
}
List information about environment variables in a context, not including their values.
context-id required | string <uuid> ID of the context (UUID) |
page-token | string A token to retrieve the next page of results. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/context/%7Bcontext-id%7D/environment-variable', qs: {'page-token': 'SOME_STRING_VALUE'}, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "variable": "POSTGRES_USER",
- "created_at": "2015-09-21T17:29:21.042Z",
- "updated_at": "2015-09-21T17:29:21.042Z",
- "context_id": "f31d7249-b7b1-4729-b3a4-ec0ba07b4686"
}
], - "next_page_token": "string"
}
Delete an environment variable from a context.
env-var-name required | string Example: POSTGRES_USER The name of the environment variable |
context-id required | string <uuid> ID of the context (UUID) |
const request = require('request'); const options = { method: 'DELETE', url: 'https://circleci.com/api/v2/context/%7Bcontext-id%7D/environment-variable/POSTGRES_USER', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "message": "string"
}
Create or update an environment variable within a context. Returns information about the environment variable, not including its value.
context-id required | string <uuid> ID of the context (UUID) |
env-var-name required | string Example: POSTGRES_USER The name of the environment variable |
value required | string The value of the environment variable |
{- "value": "some-secret-value"
}
{- "variable": "POSTGRES_USER",
- "created_at": "2015-09-21T17:29:21.042Z",
- "updated_at": "2015-09-21T17:29:21.042Z",
- "context_id": "f31d7249-b7b1-4729-b3a4-ec0ba07b4686"
}
[EXPERIMENTAL] Gets a list of project restrictions associated with a context.
context_id required | string Example: be8bb2e3-c3d6-4098-89f4-572ff976ba9a An opaque identifier of a context. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/context/be8bb2e3-c3d6-4098-89f4-572ff976ba9a/restrictions', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "context_id": "f31d7249-b7b1-4729-b3a4-ec0ba07b4686",
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
- "name": "string",
- "restriction_type": "project",
- "restriction_value": "string"
}
], - "next_page_token": "string"
}
[EXPERIMENTAL] Creates project restriction on a context.
context_id required | string Example: be8bb2e3-c3d6-4098-89f4-572ff976ba9a An opaque identifier of a context. |
project_id | string <uuid> Deprecated Deprecated - Use "restriction_type" and "restriction_value" instead. The project ID to use for a project restriction. This is mutually exclusive with restriction_type and restriction_value and implies restriction_type is "project". |
restriction_type | string |
restriction_value | string |
{- "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
- "restriction_type": "project",
- "restriction_value": "405d8375-3514-403b-8c43-83ae74cfe0e9"
}
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
- "name": "string",
- "restriction_type": "project",
- "restriction_value": "string"
}
[EXPERIMENTAL] Deletes a project restriction on a context.
context_id required | string Example: be8bb2e3-c3d6-4098-89f4-572ff976ba9a An opaque identifier of a context. |
restriction_id required | string Example: 1c23d2cb-07b1-4a28-8af3-e369732050ed An opaque identifier of a context restriction. |
const request = require('request'); const options = { method: 'DELETE', url: 'https://circleci.com/api/v2/context/be8bb2e3-c3d6-4098-89f4-572ff976ba9a/restrictions/1c23d2cb-07b1-4a28-8af3-e369732050ed', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "message": "Context restriction deleted."
}
Endpoints relating to Insights. Use Insights to monitor credit and compute usage for your projects.
Get summary metrics and trends for a project at workflow and branch level. Workflow runs going back at most 90 days are included in the aggregation window. Trends are only supported upto last 30 days. Please note that Insights is not a financial reporting tool and should not be used for precise credit reporting. Credit reporting from Insights does not use the same source of truth as the billing information that is found in the Plan Overview page in the CircleCI UI, nor does the underlying data have the same data accuracy guarantees as the billing information in the CircleCI UI. This may lead to discrepancies between credits reported from Insights and the billing information in the Plan Overview page of the CircleCI UI. For precise credit reporting, always use the Plan Overview page in the CircleCI UI.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
reporting-window | string Enum: "last-7-days" "last-90-days" "last-24-hours" "last-30-days" "last-60-days" Example: reporting-window=last-90-days The time window used to calculate summary metrics. If not provided, defaults to last-90-days |
branches | object Example: branches=A single branch: ?branches=main or for multiple branches: ?branches=main&branches=feature&branches=dev The names of VCS branches to include in branch-level workflow metrics. |
workflow-names | object Example: workflow-names=A single workflow name: ?workflow-names=build-test-deploy or
for multiple workflow names: ?workflow-names=build&workflow-names=test-and-deploy. The names of workflows to include in workflow-level metrics. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/insights/pages/gh/CircleCI-Public/api-preview-docs/summary', qs: { 'reporting-window': 'SOME_STRING_VALUE', branches: 'SOME_OBJECT_VALUE', 'workflow-names': 'SOME_OBJECT_VALUE' }, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "org_id": null,
- "project_id": null,
- "project_data": {
- "metrics": {
- "total_runs": 0,
- "total_duration_secs": 0,
- "total_credits_used": 0,
- "success_rate": 0.1,
- "throughput": 0.1
}, - "trends": {
- "total_runs": 0.1,
- "total_duration_secs": 0.1,
- "total_credits_used": 0.1,
- "success_rate": 0.1,
- "throughput": 0.1
}
}, - "project_workflow_data": [
- {
- "workflow_name": "build-and-test",
- "metrics": {
- "total_credits_used": 0,
- "p95_duration_secs": 0.1,
- "total_runs": 0,
- "success_rate": 0.1
}, - "trends": {
- "total_credits_used": 0.1,
- "p95_duration_secs": 0.1,
- "total_runs": 0.1,
- "success_rate": 0.1
}
}
], - "project_workflow_branch_data": [
- {
- "workflow_name": "build-and-test",
- "branch": "main",
- "metrics": {
- "total_credits_used": 0,
- "p95_duration_secs": 0.1,
- "total_runs": 0,
- "success_rate": 0.1
}, - "trends": {
- "total_credits_used": 0.1,
- "p95_duration_secs": 0.1,
- "total_runs": 0.1,
- "success_rate": 0.1
}
}
], - "all_branches": [
- "main"
], - "all_workflows": [
- "build-and-test"
]
}
Get timeseries data for all jobs within a workflow. Hourly granularity data is only retained for 48 hours while daily granularity data is retained for 90 days.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
workflow-name required | string Example: build-and-test The name of the workflow. |
branch | string The name of a vcs branch. If not passed we will scope the API call to the default branch. |
granularity | string Enum: "daily" "hourly" Example: granularity=hourly The granularity for which to query timeseries data. |
start-date | string <date-time> Example: start-date=2020-08-21T13:26:29Z Include only executions that started at or after this date. This must be specified if an end-date is provided. |
end-date | string <date-time> Example: end-date=2020-09-04T13:26:29Z Include only executions that started before this date. This date can be at most 90 days after the start-date. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/insights/time-series/gh/CircleCI-Public/api-preview-docs/workflows/build-and-test/jobs', qs: { branch: 'SOME_STRING_VALUE', granularity: 'SOME_STRING_VALUE', 'start-date': 'SOME_STRING_VALUE', 'end-date': 'SOME_STRING_VALUE' }, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "next_page_token": "string",
- "items": [
- {
- "name": "build-and-test",
- "min_started_at": "2019-08-24T14:15:22Z",
- "max_ended_at": "2019-08-24T14:15:22Z",
- "timestamp": "2019-08-24T14:15:22Z",
- "metrics": {
- "total_runs": 0,
- "failed_runs": 0,
- "successful_runs": 0,
- "throughput": 0.1,
- "median_credits_used": 0,
- "total_credits_used": 0,
- "duration_metrics": {
- "min": 0,
- "median": 0,
- "max": 0,
- "p95": 0,
- "total": 0
}
}
}
]
}
Gets aggregated summary metrics with trends for the entire org. Also gets aggregated metrics and trends for each project belonging to the org.
org-slug required | string Example: gh/CircleCI-Public Org slug in the form |
reporting-window | string Enum: "last-7-days" "last-90-days" "last-24-hours" "last-30-days" "last-60-days" Example: reporting-window=last-90-days The time window used to calculate summary metrics. If not provided, defaults to last-90-days |
project-names | object Example: project-names=For a single project: ?project-names=some-project or for multiple projects: ?project-names=some-project1&project-names=some-project2 List of project names. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/insights/gh/CircleCI-Public/summary', qs: {'reporting-window': 'SOME_STRING_VALUE', 'project-names': 'SOME_OBJECT_VALUE'}, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "org_data": {
- "metrics": {
- "total_runs": 0,
- "total_duration_secs": 0,
- "total_credits_used": 0,
- "success_rate": 0.1,
- "throughput": 0.1
}, - "trends": {
- "total_runs": 0.1,
- "total_duration_secs": 0.1,
- "total_credits_used": 0.1,
- "success_rate": 0.1,
- "throughput": 0.1
}
}, - "org_project_data": [
- {
- "project_name": "api-preview-docs",
- "metrics": {
- "total_credits_used": 0,
- "total_duration_secs": 0,
- "total_runs": 0,
- "success_rate": 0.1
}, - "trends": {
- "total_credits_used": 0.1,
- "total_duration_secs": 0.1,
- "total_runs": 0.1,
- "success_rate": 0.1
}
}
], - "all_projects": [
- "string"
]
}
Get a list of all branches for a specified project. The list will only contain branches currently available within Insights. The maximum number of branches returned by this endpoint is 5,000.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
workflow-name | string Example: workflow-name=build-and-test The name of a workflow. If not passed we will scope the API call to the project. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/insights/gh/CircleCI-Public/api-preview-docs/branches', qs: {'workflow-name': 'SOME_STRING_VALUE'}, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "org_id": null,
- "project_id": null,
- "branches": [
- "main"
]
}
Get a list of flaky tests for a given project. Flaky tests are branch agnostic. A flaky test is a test that passed and failed in the same commit.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/insights/gh/CircleCI-Public/api-preview-docs/flaky-tests', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "flaky-tests": [
- {
- "time-wasted": 0,
- "workflow-created-at": "string",
- "workflow-id": null,
- "classname": "string",
- "pipeline-number": 0,
- "workflow-name": "string",
- "test-name": "string",
- "job-name": "string",
- "job-number": 0,
- "times-flaked": 0,
- "source": "string",
- "file": "string"
}
], - "total-flaky-tests": 5
}
Get summary metrics for a project's workflows. Workflow runs going back at most 90 days are included in the aggregation window. Metrics are refreshed daily, and thus may not include executions from the last 24 hours. Please note that Insights is not a financial reporting tool and should not be used for precise credit reporting. Credit reporting from Insights does not use the same source of truth as the billing information that is found in the Plan Overview page in the CircleCI UI, nor does the underlying data have the same data accuracy guarantees as the billing information in the CircleCI UI. This may lead to discrepancies between credits reported from Insights and the billing information in the Plan Overview page of the CircleCI UI. For precise credit reporting, always use the Plan Overview page in the CircleCI UI.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
page-token | string A token to retrieve the next page of results. |
all-branches | boolean Whether to retrieve data for all branches combined. Use either this parameter OR the branch name parameter. |
branch | string The name of a vcs branch. If not passed we will scope the API call to the default branch. |
reporting-window | string Enum: "last-7-days" "last-90-days" "last-24-hours" "last-30-days" "last-60-days" Example: reporting-window=last-90-days The time window used to calculate summary metrics. If not provided, defaults to last-90-days |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/insights/gh/CircleCI-Public/api-preview-docs/workflows', qs: { 'page-token': 'SOME_STRING_VALUE', 'all-branches': 'SOME_BOOLEAN_VALUE', branch: 'SOME_STRING_VALUE', 'reporting-window': 'SOME_STRING_VALUE' }, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "name": "build-and-test",
- "metrics": {
- "total_runs": 0,
- "successful_runs": 0,
- "mttr": 0,
- "total_credits_used": 0,
- "failed_runs": 0,
- "success_rate": 0.1,
- "duration_metrics": {
- "min": 0,
- "mean": 0,
- "median": 0,
- "p95": 0,
- "max": 0,
- "standard_deviation": 0.1
}, - "total_recoveries": 0,
- "throughput": 0.1
}, - "window_start": "2019-08-24T14:15:22Z",
- "window_end": "2019-08-24T14:15:22Z",
- "project_id": null
}
], - "next_page_token": "string"
}
Get recent runs of a workflow. Runs going back at most 90 days are returned. Please note that Insights is not a financial reporting tool and should not be used for precise credit reporting. Credit reporting from Insights does not use the same source of truth as the billing information that is found in the Plan Overview page in the CircleCI UI, nor does the underlying data have the same data accuracy guarantees as the billing information in the CircleCI UI. This may lead to discrepancies between credits reported from Insights and the billing information in the Plan Overview page of the CircleCI UI. For precise credit reporting, always use the Plan Overview page in the CircleCI UI.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
workflow-name required | string Example: build-and-test The name of the workflow. |
all-branches | boolean Whether to retrieve data for all branches combined. Use either this parameter OR the branch name parameter. |
branch | string The name of a vcs branch. If not passed we will scope the API call to the default branch. |
page-token | string A token to retrieve the next page of results. |
start-date | string <date-time> Example: start-date=2020-08-21T13:26:29Z Include only executions that started at or after this date. This must be specified if an end-date is provided. |
end-date | string <date-time> Example: end-date=2020-09-04T13:26:29Z Include only executions that started before this date. This date can be at most 90 days after the start-date. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/insights/gh/CircleCI-Public/api-preview-docs/workflows/build-and-test', qs: { 'all-branches': 'SOME_BOOLEAN_VALUE', branch: 'SOME_STRING_VALUE', 'page-token': 'SOME_STRING_VALUE', 'start-date': 'SOME_STRING_VALUE', 'end-date': 'SOME_STRING_VALUE' }, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "branch": "main",
- "duration": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "stopped_at": "2019-08-24T14:15:22Z",
- "credits_used": 0,
- "status": "success",
- "is_approval": false
}
], - "next_page_token": "string"
}
Get summary metrics for a project workflow's jobs. Job runs going back at most 90 days are included in the aggregation window. Metrics are refreshed daily, and thus may not include executions from the last 24 hours. Please note that Insights is not a financial reporting tool and should not be used for precise credit reporting. Credit reporting from Insights does not use the same source of truth as the billing information that is found in the Plan Overview page in the CircleCI UI, nor does the underlying data have the same data accuracy guarantees as the billing information in the CircleCI UI. This may lead to discrepancies between credits reported from Insights and the billing information in the Plan Overview page of the CircleCI UI. For precise credit reporting, always use the Plan Overview page in the CircleCI UI.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
workflow-name required | string Example: build-and-test The name of the workflow. |
page-token | string A token to retrieve the next page of results. |
all-branches | boolean Whether to retrieve data for all branches combined. Use either this parameter OR the branch name parameter. |
branch | string The name of a vcs branch. If not passed we will scope the API call to the default branch. |
reporting-window | string Enum: "last-7-days" "last-90-days" "last-24-hours" "last-30-days" "last-60-days" Example: reporting-window=last-90-days The time window used to calculate summary metrics. If not provided, defaults to last-90-days |
job-name | string Example: job-name=lint The name of the jobs you would like to filter from your workflow. If not specified, all workflow jobs will be returned. The job name can either be the full job name or just a substring of the job name. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/insights/gh/CircleCI-Public/api-preview-docs/workflows/build-and-test/jobs', qs: { 'page-token': 'SOME_STRING_VALUE', 'all-branches': 'SOME_BOOLEAN_VALUE', branch: 'SOME_STRING_VALUE', 'reporting-window': 'SOME_STRING_VALUE', 'job-name': 'SOME_STRING_VALUE' }, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "name": "string",
- "metrics": {
- "total_runs": 0,
- "failed_runs": 0,
- "successful_runs": 0,
- "duration_metrics": {
- "min": 0,
- "mean": 0,
- "median": 0,
- "p95": 0,
- "max": 0,
- "standard_deviation": 0.1
}, - "success_rate": 0.1,
- "total_credits_used": 0,
- "throughput": 0.1
}, - "window_start": "2019-08-24T14:15:22Z",
- "window_end": "2019-08-24T14:15:22Z"
}
], - "next_page_token": "string"
}
Get the metrics and trends for a particular workflow on a single branch or all branches
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
workflow-name required | string Example: build-and-test The name of the workflow. |
all-branches | boolean Whether to retrieve data for all branches combined. Use either this parameter OR the branch name parameter. |
branch | string The name of a vcs branch. If not passed we will scope the API call to the default branch. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/insights/gh/CircleCI-Public/api-preview-docs/workflows/build-and-test/summary', qs: {'all-branches': 'SOME_BOOLEAN_VALUE', branch: 'SOME_STRING_VALUE'}, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "metrics": {
- "total_runs": 0,
- "successful_runs": 0,
- "mttr": 0,
- "total_credits_used": 0,
- "failed_runs": 0,
- "success_rate": 0.1,
- "completed_runs": 0,
- "window_start": "2019-08-24T14:15:22Z",
- "duration_metrics": {
- "min": 0,
- "mean": 0,
- "median": 0,
- "p95": 0,
- "max": 0,
- "standard_deviation": 0.1
}, - "window_end": "2019-08-24T14:15:22Z",
- "throughput": 0.1
}, - "trends": {
- "total_runs": 0.1,
- "failed_runs": 0.1,
- "success_rate": 0.1,
- "p95_duration_secs": 0.1,
- "median_duration_secs": 0.1,
- "total_credits_used": 0.1,
- "mttr": 0.1,
- "throughput": 0.1
}, - "workflow_names": [
- "string"
]
}
Get test metrics for a project's workflows. Currently tests metrics are calculated based on 10 most recent workflow runs.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
workflow-name required | string Example: build-and-test The name of the workflow. |
branch | string The name of a vcs branch. If not passed we will scope the API call to the default branch. |
all-branches | boolean Whether to retrieve data for all branches combined. Use either this parameter OR the branch name parameter. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/insights/gh/CircleCI-Public/api-preview-docs/workflows/build-and-test/test-metrics', qs: {branch: 'SOME_STRING_VALUE', 'all-branches': 'SOME_BOOLEAN_VALUE'}, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "average_test_count": 0,
- "most_failed_tests": [
- {
- "p95_duration": 0.1,
- "total_runs": 0,
- "classname": "string",
- "failed_runs": 0,
- "flaky": true,
- "source": "string",
- "file": "string",
- "job_name": "string",
- "test_name": "string"
}
], - "most_failed_tests_extra": 0,
- "slowest_tests": [
- {
- "p95_duration": 0.1,
- "total_runs": 0,
- "classname": "string",
- "failed_runs": 0,
- "flaky": true,
- "source": "string",
- "file": "string",
- "job_name": "string",
- "test_name": "string"
}
], - "slowest_tests_extra": 0,
- "total_test_runs": 0,
- "test_runs": [
- {
- "pipeline_number": 0,
- "workflow_id": null,
- "success_rate": 0.1,
- "test_counts": {
- "error": 0,
- "failure": 0,
- "skipped": 0,
- "success": 0,
- "total": 0
}
}
]
}
Provides information about the user that is currently signed in.
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/me', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "login": "string",
- "name": "string"
}
Provides the set of organizations of which a user is a member or a collaborator.
The set of organizations that a user can collaborate on is composed of:
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/me/collaborations', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
[- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "vcs-type": "string",
- "name": "string",
- "avatar_url": "string",
- "slug": "string"
}
]
Provides information about the user with the given ID.
id required | string <uuid> The unique ID of the user. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/user/%7Bid%7D', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "login": "string",
- "name": "string"
}
Endpoints relating to pipelines. Get information about your pipelines. Trigger or continue a pipeline.
Returns all pipelines for the most recently built projects (max 250) you follow in an organization.
org-slug | string Example: org-slug=gh/CircleCI-Public Org slug in the form |
page-token | string A token to retrieve the next page of results. |
mine | boolean Only include entries created by your user. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/pipeline', qs: { 'org-slug': 'SOME_STRING_VALUE', 'page-token': 'SOME_STRING_VALUE', mine: 'SOME_BOOLEAN_VALUE' }, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "id": "5034460f-c7c4-4c43-9457-de07e2029e7b",
- "errors": [
- {
- "type": "config",
- "message": "string"
}
], - "project_slug": "gh/CircleCI-Public/api-preview-docs",
- "updated_at": "2019-08-24T14:15:22Z",
- "number": 25,
- "trigger_parameters": {
- "property1": "string",
- "property2": "string"
}, - "state": "created",
- "created_at": "2019-08-24T14:15:22Z",
- "trigger": {
- "type": "scheduled_pipeline",
- "received_at": "2019-08-24T14:15:22Z",
- "actor": {
- "login": "string",
- "avatar_url": "string"
}
}, - "vcs": {
- "provider_name": "GitHub",
- "branch": "feature/design-new-api",
- "review_id": "123",
- "revision": "f454a02b5d10fcccfd7d9dd7608a76d6493a98b4",
- "tag": "v3.1.4159",
- "commit": {
- "subject": "string",
- "body": "string"
},
}
}
], - "next_page_token": "string"
}
Continue a pipeline from the setup phase. For information on using pipeline parameters with dynamic configuration, see the Pipeline values and parameters docs.
continuation-key required | string (PipelineContinuationKey) A pipeline continuation key. |
configuration required | string A configuration string for the pipeline. |
object An object containing pipeline parameters and their values. Pipeline parameters have the following size limits: 100 max entries, 128 maximum key length, 512 maximum value length. |
{- "continuation-key": "string",
- "configuration": "string",
- "parameters": {
- "deploy_prod": true
}
}
{- "message": "string"
}
Returns a pipeline by the pipeline ID.
pipeline-id required | string <uuid> Example: 5034460f-c7c4-4c43-9457-de07e2029e7b The unique ID of the pipeline. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/pipeline/5034460f-c7c4-4c43-9457-de07e2029e7b', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "id": "5034460f-c7c4-4c43-9457-de07e2029e7b",
- "errors": [
- {
- "type": "config",
- "message": "string"
}
], - "project_slug": "gh/CircleCI-Public/api-preview-docs",
- "updated_at": "2019-08-24T14:15:22Z",
- "number": 25,
- "trigger_parameters": {
- "property1": "string",
- "property2": "string"
}, - "state": "created",
- "created_at": "2019-08-24T14:15:22Z",
- "trigger": {
- "type": "scheduled_pipeline",
- "received_at": "2019-08-24T14:15:22Z",
- "actor": {
- "login": "string",
- "avatar_url": "string"
}
}, - "vcs": {
- "provider_name": "GitHub",
- "branch": "feature/design-new-api",
- "review_id": "123",
- "revision": "f454a02b5d10fcccfd7d9dd7608a76d6493a98b4",
- "tag": "v3.1.4159",
- "commit": {
- "subject": "string",
- "body": "string"
},
}
}
Returns a pipeline's configuration by ID.
pipeline-id required | string <uuid> Example: 5034460f-c7c4-4c43-9457-de07e2029e7b The unique ID of the pipeline. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/pipeline/5034460f-c7c4-4c43-9457-de07e2029e7b/config', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "source": "string",
- "compiled": "string",
- "setup-config": "string",
- "compiled-setup-config": "string"
}
Returns a map of pipeline values by pipeline ID. For more information see the pipeline values reference page.
pipeline-id required | string <uuid> Example: 5034460f-c7c4-4c43-9457-de07e2029e7b The unique ID of the pipeline. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/pipeline/5034460f-c7c4-4c43-9457-de07e2029e7b/values', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "property1": "string",
- "property2": "string"
}
Returns a paginated list of workflows by pipeline ID.
pipeline-id required | string <uuid> Example: 5034460f-c7c4-4c43-9457-de07e2029e7b The unique ID of the pipeline. |
page-token | string A token to retrieve the next page of results. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/pipeline/5034460f-c7c4-4c43-9457-de07e2029e7b/workflow', qs: {'page-token': 'SOME_STRING_VALUE'}, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "pipeline_id": "5034460f-c7c4-4c43-9457-de07e2029e7b",
- "canceled_by": "026a6d28-c22e-4aab-a8b4-bd7131a8ea35",
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "name": "build-and-test",
- "project_slug": "gh/CircleCI-Public/api-preview-docs",
- "errored_by": "c6e40f70-a80a-4ccc-af88-8d985a7bc622",
- "tag": "setup",
- "status": "success",
- "started_by": "03987f6a-4c27-4dc1-b6ab-c7e83bb3e713",
- "pipeline_number": 25,
- "created_at": "2019-08-24T14:15:22Z",
- "stopped_at": "2019-08-24T14:15:22Z"
}
], - "next_page_token": "string"
}
Not available to projects that use GitLab or GitHub App. Triggers a new pipeline on the project. GitHub App users should use the new Trigger Pipeline API.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
branch | string The branch where the pipeline ran. The HEAD commit on this branch was used for the pipeline. Note that |
tag | string The tag used by the pipeline. The commit that this tag points to was used for the pipeline. Note that |
object An object containing pipeline parameters and their values. Pipeline parameters have the following size limits: 100 max entries, 128 maximum key length, 512 maximum value length. |
{- "branch": "feature/design-new-api",
- "tag": "v3.1.4159",
- "parameters": {
- "deploy_prod": true
}
}
{- "id": "5034460f-c7c4-4c43-9457-de07e2029e7b",
- "state": "created",
- "number": 25,
- "created_at": "2019-08-24T14:15:22Z"
}
Returns all pipelines for this project.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
branch | string The name of a vcs branch. |
page-token | string A token to retrieve the next page of results. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs/pipeline', qs: {branch: 'SOME_STRING_VALUE', 'page-token': 'SOME_STRING_VALUE'}, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "id": "5034460f-c7c4-4c43-9457-de07e2029e7b",
- "errors": [
- {
- "type": "config",
- "message": "string"
}
], - "project_slug": "gh/CircleCI-Public/api-preview-docs",
- "updated_at": "2019-08-24T14:15:22Z",
- "number": 25,
- "trigger_parameters": {
- "property1": "string",
- "property2": "string"
}, - "state": "created",
- "created_at": "2019-08-24T14:15:22Z",
- "trigger": {
- "type": "scheduled_pipeline",
- "received_at": "2019-08-24T14:15:22Z",
- "actor": {
- "login": "string",
- "avatar_url": "string"
}
}, - "vcs": {
- "provider_name": "GitHub",
- "branch": "feature/design-new-api",
- "review_id": "123",
- "revision": "f454a02b5d10fcccfd7d9dd7608a76d6493a98b4",
- "tag": "v3.1.4159",
- "commit": {
- "subject": "string",
- "body": "string"
},
}
}
], - "next_page_token": "string"
}
Returns a sequence of all pipelines for this project triggered by the user.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
page-token | string A token to retrieve the next page of results. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs/pipeline/mine', qs: {'page-token': 'SOME_STRING_VALUE'}, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "id": "5034460f-c7c4-4c43-9457-de07e2029e7b",
- "errors": [
- {
- "type": "config",
- "message": "string"
}
], - "project_slug": "gh/CircleCI-Public/api-preview-docs",
- "updated_at": "2019-08-24T14:15:22Z",
- "number": 25,
- "trigger_parameters": {
- "property1": "string",
- "property2": "string"
}, - "state": "created",
- "created_at": "2019-08-24T14:15:22Z",
- "trigger": {
- "type": "scheduled_pipeline",
- "received_at": "2019-08-24T14:15:22Z",
- "actor": {
- "login": "string",
- "avatar_url": "string"
}
}, - "vcs": {
- "provider_name": "GitHub",
- "branch": "feature/design-new-api",
- "review_id": "123",
- "revision": "f454a02b5d10fcccfd7d9dd7608a76d6493a98b4",
- "tag": "v3.1.4159",
- "commit": {
- "subject": "string",
- "body": "string"
},
}
}
], - "next_page_token": "string"
}
Returns a pipeline by the pipeline number.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
pipeline-number required | any Example: 123 The number of the pipeline. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs/pipeline/123', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "id": "5034460f-c7c4-4c43-9457-de07e2029e7b",
- "errors": [
- {
- "type": "config",
- "message": "string"
}
], - "project_slug": "gh/CircleCI-Public/api-preview-docs",
- "updated_at": "2019-08-24T14:15:22Z",
- "number": 25,
- "trigger_parameters": {
- "property1": "string",
- "property2": "string"
}, - "state": "created",
- "created_at": "2019-08-24T14:15:22Z",
- "trigger": {
- "type": "scheduled_pipeline",
- "received_at": "2019-08-24T14:15:22Z",
- "actor": {
- "login": "string",
- "avatar_url": "string"
}
}, - "vcs": {
- "provider_name": "GitHub",
- "branch": "feature/design-new-api",
- "review_id": "123",
- "revision": "f454a02b5d10fcccfd7d9dd7608a76d6493a98b4",
- "tag": "v3.1.4159",
- "commit": {
- "subject": "string",
- "body": "string"
},
}
}
Trigger a pipeline given a pipeline definition ID. Supports all integrations except GitLab.
provider required | string Enum: "github" "gh" "bitbucket" "bb" "circleci" Example: gh The |
organization required | string Example: CircleCI-Public The |
project required | string Example: api-preview-docs The |
definition_id | string <uuid> The unique id for the pipeline definition. This can be found in the page Project Settings > Pipelines. |
object | |
object | |
object An object containing pipeline parameters and their values. Pipeline parameters have the following size limits: 100 max entries, 128 maximum key length, 512 maximum value length. |
{- "definition_id": "2338d0ae-5541-4bbf-88a2-55e9f7281f80",
- "config": {
- "branch": "main"
}, - "checkout": {
- "tag": "v2"
}, - "parameters": {
- "example_param": "my value",
- "example_param2": true,
- "example_param3": 3
}
}
{- "state": "created",
- "created_at": "2019-08-24T14:15:22Z",
- "number": 25,
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
}
Endpoints relating to jobs. Get information about your jobs, retrieve job assets, cancel a job.
Cancel job with a given job ID.
job-id required | string <uuid> The unique ID of the job. |
const request = require('request'); const options = { method: 'POST', url: 'https://circleci.com/api/v2/jobs/%7Bjob-id%7D/cancel', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "message": "string"
}
Returns job details.
job-number required | any Example: 123 The number of the job. |
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs/job/123', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "web_url": "string",
- "project": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "slug": "gh/CircleCI-Public/api-preview-docs",
- "name": "api-preview-docs",
}, - "parallel_runs": [
- {
- "index": 0,
- "status": "string"
}
], - "started_at": "2019-08-24T14:15:22Z",
- "latest_workflow": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "name": "build-and-test"
}, - "name": "string",
- "executor": {
- "resource_class": "string",
- "type": "string"
}, - "parallelism": 0,
- "status": "success",
- "number": 1,
- "pipeline": {
- "id": "5034460f-c7c4-4c43-9457-de07e2029e7b"
}, - "duration": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "messages": [
- {
- "type": "string",
- "message": "string",
- "reason": "string"
}
], - "contexts": [
- {
- "name": "string"
}
], - "organization": {
- "name": "string"
}, - "queued_at": "2019-08-24T14:15:22Z",
- "stopped_at": "2019-08-24T14:15:22Z"
}
Cancel job with a given job number.
job-number required | any Example: 123 The number of the job. |
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
const request = require('request'); const options = { method: 'POST', url: 'https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs/job/123/cancel', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "message": "string"
}
Returns a job's artifacts.
job-number required | any Example: 123 The number of the job. |
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs/123/artifacts', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "path": "string",
- "node_index": 0,
- "url": "string"
}
], - "next_page_token": "string"
}
Get test metadata for a build. In the rare case where there is more than 250MB of test data on the job, no results will be returned.
job-number required | any Example: 123 The number of the job. |
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs/123/tests', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "message": "",
- "source": "",
- "run_time": "",
- "file": "",
- "result": "",
- "name": "",
- "classname": ""
}
], - "next_page_token": "string"
}
Endpoints relating to workflows. Get information about your workflows, or interact with them to rerun, cancel or approve a job.
Returns summary fields of a workflow by ID.
id required | string <uuid> Example: 5034460f-c7c4-4c43-9457-de07e2029e7b The unique ID of the workflow. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/workflow/5034460f-c7c4-4c43-9457-de07e2029e7b', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "pipeline_id": "5034460f-c7c4-4c43-9457-de07e2029e7b",
- "canceled_by": "026a6d28-c22e-4aab-a8b4-bd7131a8ea35",
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "name": "build-and-test",
- "project_slug": "gh/CircleCI-Public/api-preview-docs",
- "errored_by": "c6e40f70-a80a-4ccc-af88-8d985a7bc622",
- "tag": "setup",
- "status": "success",
- "started_by": "03987f6a-4c27-4dc1-b6ab-c7e83bb3e713",
- "pipeline_number": 25,
- "created_at": "2019-08-24T14:15:22Z",
- "stopped_at": "2019-08-24T14:15:22Z"
}
Approves a pending approval job in a workflow.
approval_request_id required | string <uuid> The ID of the job being approved. |
id required | string <uuid> Example: 5034460f-c7c4-4c43-9457-de07e2029e7b The unique ID of the workflow. |
const request = require('request'); const options = { method: 'POST', url: 'https://circleci.com/api/v2/workflow/5034460f-c7c4-4c43-9457-de07e2029e7b/approve/%7Bapproval_request_id%7D', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "message": "string"
}
Cancels a running workflow.
id required | string <uuid> Example: 5034460f-c7c4-4c43-9457-de07e2029e7b The unique ID of the workflow. |
const request = require('request'); const options = { method: 'POST', url: 'https://circleci.com/api/v2/workflow/5034460f-c7c4-4c43-9457-de07e2029e7b/cancel', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "message": "string"
}
Returns a sequence of jobs for a workflow.
id required | string <uuid> Example: 5034460f-c7c4-4c43-9457-de07e2029e7b The unique ID of the workflow. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/workflow/5034460f-c7c4-4c43-9457-de07e2029e7b/job', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "canceled_by": "026a6d28-c22e-4aab-a8b4-bd7131a8ea35",
- "dependencies": [
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
], - "job_number": 1,
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "started_at": "2019-08-24T14:15:22Z",
- "name": "string",
- "approved_by": "02030314-b162-4b4d-8af1-88eabdcc615d",
- "project_slug": "gh/CircleCI-Public/api-preview-docs",
- "status": "success",
- "type": "build",
- "stopped_at": "2019-08-24T14:15:22Z",
- "approval_request_id": "47bbf9d9-0b01-4281-9b67-9324ae3d0dff"
}
], - "next_page_token": "string"
}
Reruns a workflow.
id required | string <uuid> Example: 5034460f-c7c4-4c43-9457-de07e2029e7b The unique ID of the workflow. |
enable_ssh | boolean Whether to enable SSH access for the triggering user on the newly-rerun job. Requires the jobs parameter to be used and so is mutually exclusive with the from_failed parameter. |
from_failed | boolean Whether to rerun the workflow from the failed job. Mutually exclusive with the jobs parameter. |
jobs | Array of strings <uuid> [ items <uuid > ] A list of job IDs to rerun. |
sparse_tree | boolean Completes rerun using sparse trees logic, an optimization for workflows that have disconnected subgraphs. Requires jobs parameter and so is mutually exclusive with the from_failed parameter. |
{- "enable_ssh": false,
- "from_failed": false,
- "jobs": [
- "c65b68ef-e73b-4bf2-be9a-7a322a9df150",
- "5e957edd-5e8c-4985-9178-5d0d69561822"
], - "sparse_tree": false
}
{- "workflow_id": "0e53027b-521a-4c40-9042-47e72b3c63a3"
}
Endpoints relating to outbound webhooks. Use outbound webhooks to integrate your CircleCI builds with external services.
Creates an outbound webhook.
name required | string Name of the webhook |
events required | Array of strings Items Enum: "workflow-completed" "job-completed" Events that will trigger the webhook |
url required | string URL to deliver the webhook to. Note: protocol must be included as well (only https is supported) |
verify-tls required | boolean Whether to enforce TLS certificate verification when delivering the webhook |
signing-secret required | string Secret used to build an HMAC hash of the payload and passed as a header in the webhook request |
required | object The scope in which the relevant events that will trigger webhooks |
{- "name": "string",
- "events": [
- "workflow-completed"
], - "url": "string",
- "verify-tls": true,
- "signing-secret": "string",
- "scope": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "type": "project"
}
}
{- "url": "string",
- "verify-tls": true,
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "signing-secret": "string",
- "updated-at": "2015-09-21T17:29:21.042Z",
- "name": "string",
- "created-at": "2015-09-21T17:29:21.042Z",
- "scope": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "type": "string"
}, - "events": [
- "workflow-completed"
]
}
Get a list of outbound webhooks that match the given scope-type and scope-id
scope-id required | string <uuid> ID of the scope being used (at the moment, only project ID is supported) |
scope-type required | string Value: "project" Type of the scope being used |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/webhook', qs: {'scope-id': 'SOME_STRING_VALUE', 'scope-type': 'SOME_STRING_VALUE'}, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "url": "string",
- "verify-tls": true,
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "signing-secret": "string",
- "updated-at": "2015-09-21T17:29:21.042Z",
- "name": "string",
- "created-at": "2015-09-21T17:29:21.042Z",
- "scope": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "type": "string"
}, - "events": [
- "workflow-completed"
]
}
], - "next_page_token": "string"
}
Updates an outbound webhook.
webhook-id required | string <uuid> ID of the webhook (UUID) |
name | string Name of the webhook |
events | Array of strings Items Enum: "workflow-completed" "job-completed" Events that will trigger the webhook |
url | string URL to deliver the webhook to. Note: protocol must be included as well (only https is supported) |
signing-secret | string Secret used to build an HMAC hash of the payload and passed as a header in the webhook request |
verify-tls | boolean Whether to enforce TLS certificate verification when delivering the webhook |
{- "name": "string",
- "events": [
- "workflow-completed"
], - "url": "string",
- "signing-secret": "string",
- "verify-tls": true
}
{- "url": "string",
- "verify-tls": true,
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "signing-secret": "string",
- "updated-at": "2015-09-21T17:29:21.042Z",
- "name": "string",
- "created-at": "2015-09-21T17:29:21.042Z",
- "scope": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "type": "string"
}, - "events": [
- "workflow-completed"
]
}
Deletes an outbound webhook
webhook-id required | string <uuid> ID of the webhook (UUID) |
const request = require('request'); const options = { method: 'DELETE', url: 'https://circleci.com/api/v2/webhook/%7Bwebhook-id%7D', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "message": "string"
}
Get an outbound webhook by id.
webhook-id required | string <uuid> ID of the webhook (UUID) |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/webhook/%7Bwebhook-id%7D', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "url": "string",
- "verify-tls": true,
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "signing-secret": "string",
- "updated-at": "2015-09-21T17:29:21.042Z",
- "name": "string",
- "created-at": "2015-09-21T17:29:21.042Z",
- "scope": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "type": "string"
}, - "events": [
- "workflow-completed"
]
}
Deletes org-level custom claims of OIDC identity tokens
orgID required | string <uuid> |
claims required | string comma separated list of claims to delete. Valid values are "audience" and "ttl". |
const request = require('request'); const options = { method: 'DELETE', url: 'https://circleci.com/api/v2/org/%7BorgID%7D/oidc-custom-claims', qs: {claims: 'SOME_STRING_VALUE'}, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "audience": [
- "string"
], - "audience_updated_at": "2019-08-24T14:15:22Z",
- "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
- "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
- "ttl": "string",
- "ttl_updated_at": "2019-08-24T14:15:22Z"
}
Fetches org-level custom claims of OIDC identity tokens
orgID required | string <uuid> |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/org/%7BorgID%7D/oidc-custom-claims', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "audience": [
- "string"
], - "audience_updated_at": "2019-08-24T14:15:22Z",
- "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
- "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
- "ttl": "string",
- "ttl_updated_at": "2019-08-24T14:15:22Z"
}
Creates/Updates org-level custom claims of OIDC identity tokens
orgID required | string <uuid> |
audience | Array of strings |
ttl | string (JSONDuration) ^([0-9]+(ms|s|m|h|d|w)){1,7}$ |
{- "audience": [
- "string"
], - "ttl": "string"
}
{- "audience": [
- "string"
], - "audience_updated_at": "2019-08-24T14:15:22Z",
- "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
- "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
- "ttl": "string",
- "ttl_updated_at": "2019-08-24T14:15:22Z"
}
Deletes project-level custom claims of OIDC identity tokens
orgID required | string <uuid> |
projectID required | string <uuid> |
claims required | string comma separated list of claims to delete. Valid values are "audience" and "ttl". |
const request = require('request'); const options = { method: 'DELETE', url: 'https://circleci.com/api/v2/org/%7BorgID%7D/project/%7BprojectID%7D/oidc-custom-claims', qs: {claims: 'SOME_STRING_VALUE'}, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "audience": [
- "string"
], - "audience_updated_at": "2019-08-24T14:15:22Z",
- "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
- "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
- "ttl": "string",
- "ttl_updated_at": "2019-08-24T14:15:22Z"
}
Fetches project-level custom claims of OIDC identity tokens
orgID required | string <uuid> |
projectID required | string <uuid> |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/org/%7BorgID%7D/project/%7BprojectID%7D/oidc-custom-claims', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "audience": [
- "string"
], - "audience_updated_at": "2019-08-24T14:15:22Z",
- "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
- "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
- "ttl": "string",
- "ttl_updated_at": "2019-08-24T14:15:22Z"
}
Creates/Updates project-level custom claims of OIDC identity tokens
orgID required | string <uuid> |
projectID required | string <uuid> |
audience | Array of strings |
ttl | string (JSONDuration) ^([0-9]+(ms|s|m|h|d|w)){1,7}$ |
{- "audience": [
- "string"
], - "ttl": "string"
}
{- "audience": [
- "string"
], - "audience_updated_at": "2019-08-24T14:15:22Z",
- "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
- "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
- "ttl": "string",
- "ttl_updated_at": "2019-08-24T14:15:22Z"
}
This endpoint will return a list of decision audit logs that were made using this owner's policies.
ownerID required | string |
context required | string |
status | string Return decisions matching this decision status. |
after | string <date-time> Return decisions made after this date. |
before | string <date-time> Return decisions made before this date. |
branch | string Return decisions made on this branch. |
project_id | string Return decisions made for this project. |
build_number | string Return decisions made for this build number. |
offset | integer Sets the offset when retrieving the decisions, for paging. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/owner/%7BownerID%7D/context/%7Bcontext%7D/decision', qs: { status: 'SOME_STRING_VALUE', after: 'SOME_STRING_VALUE', before: 'SOME_STRING_VALUE', branch: 'SOME_STRING_VALUE', project_id: 'SOME_STRING_VALUE', build_number: 'SOME_STRING_VALUE', offset: 'SOME_INTEGER_VALUE' }, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
[- {
- "created_at": "2019-08-24T14:15:22Z",
- "decision": {
- "enabled_rules": [
- "string"
], - "hard_failures": [
- {
- "reason": "string",
- "rule": "string"
}
], - "reason": "string",
- "soft_failures": [
- {
- "reason": "string",
- "rule": "string"
}
], - "status": "string"
}, - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "metadata": {
- "build_number": 0,
- "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
- "ssh_rerun": true,
- "vcs": {
- "branch": "string",
- "origin_repository_url": "string",
- "release_tag": "string",
- "target_repository_url": "string"
}
}, - "policies": {
- "policy_name1": "1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75",
- "policy_name2": "5267768822ee624d48fce15ec5ca79cbd602cb7f4c2157a516556991f22ef8c7b5ef7b18d1ff41c59370efb0858651d44a936c11b7b144c48fe04df3c6a3e8da"
}, - "time_taken_ms": 0
}
]
This endpoint will evaluate input data (config+metadata) against owner's stored policies and return a decision.
ownerID required | string |
context required | string |
input required | string |
metadata | object |
{- "input": "string",
- "metadata": { }
}
{- "enabled_rules": [
- "string"
], - "hard_failures": [
- {
- "reason": "string",
- "rule": "string"
}
], - "reason": "string",
- "soft_failures": [
- {
- "reason": "string",
- "rule": "string"
}
], - "status": "string"
}
This endpoint retrieves the current decision settings (eg enable/disable policy evaluation)
ownerID required | string |
context required | string |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/owner/%7BownerID%7D/context/%7Bcontext%7D/decision/settings', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "enabled": true
}
This endpoint allows modifying decision settings (eg enable/disable policy evaluation)
ownerID required | string |
context required | string |
enabled | boolean |
{- "enabled": true
}
{- "enabled": true
}
This endpoint will retrieve a decision for a given decision log ID
ownerID required | string |
context required | string |
decisionID required | string |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/owner/%7BownerID%7D/context/%7Bcontext%7D/decision/%7BdecisionID%7D', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "created_at": "2019-08-24T14:15:22Z",
- "decision": {
- "enabled_rules": [
- "string"
], - "hard_failures": [
- {
- "reason": "string",
- "rule": "string"
}
], - "reason": "string",
- "soft_failures": [
- {
- "reason": "string",
- "rule": "string"
}
], - "status": "string"
}, - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "metadata": {
- "build_number": 0,
- "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
- "ssh_rerun": true,
- "vcs": {
- "branch": "string",
- "origin_repository_url": "string",
- "release_tag": "string",
- "target_repository_url": "string"
}
}, - "policies": {
- "policy_name1": "1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75",
- "policy_name2": "5267768822ee624d48fce15ec5ca79cbd602cb7f4c2157a516556991f22ef8c7b5ef7b18d1ff41c59370efb0858651d44a936c11b7b144c48fe04df3c6a3e8da"
}, - "time_taken_ms": 0
}
This endpoint will retrieve a policy bundle for a given decision log ID
ownerID required | string |
context required | string |
decisionID required | string |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/owner/%7BownerID%7D/context/%7Bcontext%7D/decision/%7BdecisionID%7D/policy-bundle', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "property1": [
- {
- "content": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "name": "string"
}
], - "property2": [
- {
- "content": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "name": "string"
}
]
}
This endpoint will retrieve a policy bundle
ownerID required | string |
context required | string |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/owner/%7BownerID%7D/context/%7Bcontext%7D/policy-bundle', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "property1": [
- {
- "content": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "name": "string"
}
], - "property2": [
- {
- "content": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "name": "string"
}
]
}
This endpoint replaces the current policy bundle with the provided policy bundle
ownerID required | string |
context required | string |
dry | boolean |
object |
{- "policies": {
- "property1": "string",
- "property2": "string"
}
}
{- "created": [
- "string"
], - "deleted": [
- "string"
], - "modified": [
- "string"
]
}
This endpoint will retrieve a policy document.
ownerID required | string |
context required | string |
policyName required | string the policy name set by the rego policy_name rule |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/owner/%7BownerID%7D/context/%7Bcontext%7D/policy-bundle/%7BpolicyName%7D', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "content": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "name": "string"
}
Retrieves a project by project slug.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "slug": "gh/CircleCI-Public/api-preview-docs",
- "name": "api-preview-docs",
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "organization_name": "CircleCI-Public",
- "organization_slug": "CircleCI-Public",
- "organization_id": "CircleCI-Public",
- "vcs_info": {
- "provider": "Bitbucket",
- "default_branch": "main"
}
}
Returns a sequence of checkout keys for :project
.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
digest | string Enum: "sha256" "md5" The fingerprint digest type to return. This may be either |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs/checkout-key', qs: {digest: 'SOME_STRING_VALUE'}, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "public-key": "ssh-rsa ...",
- "type": "deploy-key",
- "fingerprint": "c9:0b:1c:4f:d5:65:56:b9:ad:88:f9:81:2b:37:74:2f",
- "preferred": true,
- "created-at": "2015-09-21T17:29:21.042Z"
}
], - "next_page_token": "string"
}
Not available to projects that use GitLab or GitHub App. Creates a new checkout key. This API request is only usable with a user API token. Please ensure that you have authorized your account with GitHub before creating user keys. This is necessary to give CircleCI the permission to create a user key associated with your GitHub user account. You can find this page by visiting Project Settings > Checkout SSH Keys
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
type required | string (CheckoutKeyInputType) Enum: "user-key" "deploy-key" The type of checkout key to create. This may be either |
{- "type": "deploy-key"
}
{- "public-key": "ssh-rsa ...",
- "type": "deploy-key",
- "fingerprint": "c9:0b:1c:4f:d5:65:56:b9:ad:88:f9:81:2b:37:74:2f",
- "preferred": true,
- "created-at": "2015-09-21T17:29:21.042Z"
}
Deletes the checkout key via md5 or sha256 fingerprint. sha256 keys should be url-encoded.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
fingerprint required | string Example: c9:0b:1c:4f:d5:65:56:b9:ad:88:f9:81:2b:37:74:2f An SSH key fingerprint. |
const request = require('request'); const options = { method: 'DELETE', url: 'https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs/checkout-key/c9:0b:1c:4f:d5:65:56:b9:ad:88:f9:81:2b:37:74:2f', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "message": "string"
}
Returns an individual checkout key via md5 or sha256 fingerprint. sha256 keys should be url-encoded.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
fingerprint required | string Example: c9:0b:1c:4f:d5:65:56:b9:ad:88:f9:81:2b:37:74:2f An SSH key fingerprint. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs/checkout-key/c9:0b:1c:4f:d5:65:56:b9:ad:88:f9:81:2b:37:74:2f', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "public-key": "ssh-rsa ...",
- "type": "deploy-key",
- "fingerprint": "c9:0b:1c:4f:d5:65:56:b9:ad:88:f9:81:2b:37:74:2f",
- "preferred": true,
- "created-at": "2015-09-21T17:29:21.042Z"
}
Returns four 'x' characters, in addition to the last four ASCII characters of the value, consistent with the display of environment variable values on the CircleCI website.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs/envvar', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "name": "foo",
- "value": "xxxx1234",
- "created-at": "#joda/inst 2023-04-14T21:20:14+0000"
}
], - "next_page_token": "string"
}
Creates a new environment variable.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
name required | string The name of the environment variable. |
value required | string The value of the environment variable. |
{- "name": "foo",
- "value": "xxxx1234"
}
{- "name": "foo",
- "value": "xxxx1234",
- "created-at": "#joda/inst 2023-04-14T21:20:14+0000"
}
Deletes the environment variable named :name.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
name required | string Example: foo The name of the environment variable. |
const request = require('request'); const options = { method: 'DELETE', url: 'https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs/envvar/foo', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "message": "string"
}
Returns the masked value of environment variable :name.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
name required | string Example: foo The name of the environment variable. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs/envvar/foo', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "name": "foo",
- "value": "xxxx1234",
- "created-at": "#joda/inst 2023-04-14T21:20:14+0000"
}
[EXPERIMENTAL] Creates a new CircleCI project, and returns a list of the default advanced settings. Can only be called on a repo with a main branch and an existing config.yml file. Not yet available to projects that use GitLab or GitHub App.
provider required | string Example: gh The |
organization required | string Example: CircleCI-Public The |
project required | string Example: api-preview-docs The |
const request = require('request'); const options = { method: 'POST', url: 'https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "advanced": {
- "autocancel_builds": true,
- "build_fork_prs": true,
- "build_prs_only": true,
- "disable_ssh": true,
- "forks_receive_secret_env_vars": true,
- "oss": true,
- "set_github_status": true,
- "setup_workflows": true,
- "write_settings_requires_admin": true,
- "pr_only_branch_overrides": [
- "string"
]
}
}
[EXPERIMENTAL] Returns a list of the advanced settings for a CircleCI project, whether enabled (true) or not (false).
provider required | string Example: gh The |
organization required | string Example: CircleCI-Public The |
project required | string Example: api-preview-docs The |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs/settings', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "advanced": {
- "autocancel_builds": true,
- "build_fork_prs": true,
- "build_prs_only": true,
- "disable_ssh": true,
- "forks_receive_secret_env_vars": true,
- "oss": true,
- "set_github_status": true,
- "setup_workflows": true,
- "write_settings_requires_admin": true,
- "pr_only_branch_overrides": [
- "string"
]
}
}
[EXPERIMENTAL] Updates one or more of the advanced settings for a CircleCI project.
provider required | string Example: gh The |
organization required | string Example: CircleCI-Public The |
project required | string Example: api-preview-docs The |
The setting(s) to update, including one or more fields in the JSON object. Note that oss: true
will only be set on projects whose underlying repositories are actually open source.
object |
{- "advanced": {
- "autocancel_builds": false,
- "build_prs_only": true,
- "pr_only_branch_overrides": [
- "main"
]
}
}
{- "advanced": {
- "autocancel_builds": true,
- "build_fork_prs": true,
- "build_prs_only": true,
- "disable_ssh": true,
- "forks_receive_secret_env_vars": true,
- "oss": true,
- "set_github_status": true,
- "setup_workflows": true,
- "write_settings_requires_admin": true,
- "pr_only_branch_overrides": [
- "string"
]
}
}
Endpoints related to organization usage exports.
The Usage API is an API provided by CircleCI to customers to access all of their usage data on CircleCI. It contains all the metadata (org, project, pipeline, workflow, and job dimensions) as well as credit consumption data. It is provided at the near lowest level of granularity (at the job run level).
Restrictions
Requirements
Report Fields
Field | Description | |
---|---|---|
organization_id | The org ID | |
organization_name | The org name | |
organization_created_date | The date (UTC) that the org was created | |
Project-level attributes | project_id | The project ID / token |
project_name | The project name. For classic orgs, the project name is inherited from Github. For standalone, the org is set by the user. | |
project_created_date | The date (UTC) that the project was created. For classic orgs, this is the date that the repo was authorized on CircleCI. For standalone orgs, this is the date that the project was created on CircleCI | |
last_build_finished_at | The date (UTC) of the last pipeline run on this project | |
Pipeline-level attributes | vcs_name | The name of the VCS connected to the project on which the pipeline was run |
vcs_url | The URL of the VCS on which the pipeline was run | |
vcs_branch | The branch on which the pipeline was run | |
pipeline_id | The ID of the pipeline instance that was triggered. If a pipeline is re-run, it will share the same pipeline ID as the original pipeline instance | |
pipeline_created_at | The date (UTC) the pipeline instance was first triggered | |
pipeline_number | The pipeline number | |
is_unregistered_user | Y/N flag of whether the pipeline was triggered by a CircleCI user or a user not registered on CircleCI. Examples of the latter include users who commit on a connected VCS and consume credits on CircleCI. | |
pipeline_trigger_source | The source of the pipeline instance trigger (API, webhook, etc.) | |
pipeline_trigger_user_id | The user ID / token of the user who triggered the pipeline | |
Workflow-level attributes | workflow_id | The ID of the workflow instance that was triggered |
workflow_name | The name of the workflow | |
workflow_first_job_queued_at | The timestamp (UTC) of when the workflow instance started to queue | |
workflow_first_job_started_at | The timestamp (UTC) of when the workflow instance started to run | |
workflow_stopped_at | The timestamp (UTC) of when the workflow instance stopped | |
is_workflow_successful | Y/N flag of whether all jobs in the workflow were successfully ran | |
Job-level attributes | job_name | The name of the job (the name the customer sees in the UI) |
job_id | The ID of the job run instance that was triggered | |
job_run_number | The number of the job run instance that was triggered | |
job_run_date | The date (UTC) of the job run instance began | |
job_run_queued_at | The timestamp (UTC) of when the job started to queue | |
job_run_started_at | The timestamp (UTC) of when the job started to run | |
job_run_stopped_at | The timestamp (UTC) of when the job stopped | |
job_build_status | The status of the job run instance | |
resource_class | The resource class of the job run instance | |
operating_system | The operating system of the job run instance | |
executor | The executor of the job run instance | |
parallelism | The parallelism of the job run instance | |
job_run_seconds | The duration in seconds of the job run instance | |
median_cpu_utilization_pct | The median CPU utilization calculated over the course of the entire job run instance. CPU utilization is logged every 15 seconds. It will not be available for any jobs under 15 seconds and occasionally will not be available for jobs greater than 15 seconds. | |
max_cpu_utilization_pct | The max CPU utilization logged over the course of the entire job run instance. CPU utilization is logged every 15 seconds. It will not be available for any jobs under 15 seconds and occasionally will not be available for jobs greater than 15 seconds. | |
median_ram_utilization_pct | The median RAM utilization calculated over the course of the entire job run instance. RAM utilization is logged every 15 seconds. It will not be available for any jobs under 15 seconds and occasionally will not be available for jobs greater than 15 seconds. | |
max_ram_utilization_pct | The max RAM utilization logged over the course of the entire job run instance. RAM utilization is logged every 15 seconds. It will not be available for any jobs under 15 seconds and occasionally will not be available for jobs greater than 15 seconds. | |
Credit consumption metrics | compute_credits | The compute credits consumed by this job run instance |
dlc_credits | The docker-layer caching credits consumed by this job run instance | |
user_credits | The user credits consumed by this job run instance | |
storage_credits | The storage credits consumed by this job run instance | |
network_credits | The network credits consumed by this job run instance | |
lease_credits | The lease credits consumed by this job run instance | |
lease_overage_credits | The lease overage credits consumed by this job run instance | |
ipranges_credits | The IP ranges credits consumed by this job run instance | |
total_credits | The total credits consumed by this job run instance |
Submits a request to create a usage export for an organization.
org_id required | string Example: b9291e0d-a11e-41fb-8517-c545388b5953 An opaque identifier of an organization. |
start required | string <date-time> The start date & time (inclusive) of the range from which data will be pulled. Must be no more than one year ago. |
end required | string <date-time> The end date & time (inclusive) of the range from which data will be pulled. Must be no more than 31 days after |
shared_org_ids | Array of strings <uuid> [ items <uuid > ] |
{- "start": "2019-08-24T14:15:22Z",
- "end": "2019-08-24T14:15:22Z",
- "shared_org_ids": [
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
]
}
{- "usage_export_job_id": "7cd4bded-f639-433a-876b-1a8ea9f53127",
- "state": "created",
- "start": "2019-08-24T14:15:22Z",
- "end": "2019-08-24T14:15:22Z",
}
Gets a usage export for an organization.
org_id required | string Example: b9291e0d-a11e-41fb-8517-c545388b5953 An opaque identifier of an organization. |
usage_export_job_id required | string <uuid> Example: e8235eed-f121-4ae3-9c72-2719d6572818 An opaque identifier of a usage export job. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/organizations/b9291e0d-a11e-41fb-8517-c545388b5953/usage_export_job/e8235eed-f121-4ae3-9c72-2719d6572818', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "usage_export_job_id": "7cd4bded-f639-433a-876b-1a8ea9f53127",
- "state": "created",
- "error_reason": "string"
}
Not yet available to projects that use GitLab or GitHub App. Creates a schedule and returns the created schedule.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
name required | string Name of the schedule. |
required | object or object Timetable that specifies when a schedule triggers. |
attribution-actor required | string Enum: "current" "system" The attribution-actor of the scheduled pipeline. |
required | object Pipeline parameters represented as key-value pairs. Must contain branch or tag. |
description | string or null Description of the schedule. |
{- "name": "string",
- "timetable": {
- "per-hour": 0,
- "hours-of-day": [
- 0
], - "days-of-week": [
- "TUE"
], - "days-of-month": [
- 0
], - "months": [
- "MAR"
]
}, - "attribution-actor": "current",
- "parameters": {
- "deploy_prod": true,
- "branch": "feature/design-new-api"
}, - "description": "string"
}
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "timetable": {
- "per-hour": 0,
- "hours-of-day": [
- 0
], - "days-of-week": [
- "TUE"
], - "days-of-month": [
- 0
], - "months": [
- "MAR"
]
}, - "updated-at": "2019-08-24T14:15:22Z",
- "name": "string",
- "created-at": "2019-08-24T14:15:22Z",
- "project-slug": "gh/CircleCI-Public/api-preview-docs",
- "parameters": {
- "deploy_prod": true,
- "branch": "feature/design-new-api"
}, - "actor": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "login": "string",
- "name": "string"
}, - "description": "string"
}
Returns all schedules for this project.
project-slug required | string Example: gh/CircleCI-Public/api-preview-docs Project slug in the form |
page-token | string A token to retrieve the next page of results. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs/schedule', qs: {'page-token': 'SOME_STRING_VALUE'}, headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "timetable": {
- "per-hour": 0,
- "hours-of-day": [
- 0
], - "days-of-week": [
- "TUE"
], - "days-of-month": [
- 0
], - "months": [
- "MAR"
]
}, - "updated-at": "2019-08-24T14:15:22Z",
- "name": "string",
- "created-at": "2019-08-24T14:15:22Z",
- "project-slug": "gh/CircleCI-Public/api-preview-docs",
- "parameters": {
- "deploy_prod": true,
- "branch": "feature/design-new-api"
}, - "actor": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "login": "string",
- "name": "string"
}, - "description": "string"
}
], - "next_page_token": "string"
}
Not yet available to projects that use GitLab or GitHub App. Updates a schedule and returns the updated schedule.
schedule-id required | string <uuid> The unique ID of the schedule. |
description | string or null Description of the schedule. |
name | string Name of the schedule. |
object Timetable that specifies when a schedule triggers. | |
attribution-actor | string Enum: "current" "system" The attribution-actor of the scheduled pipeline. |
object Pipeline parameters represented as key-value pairs. Must contain branch or tag. |
{- "description": "string",
- "name": "string",
- "timetable": {
- "per-hour": 0,
- "hours-of-day": [
- 0
], - "days-of-week": [
- "TUE"
], - "days-of-month": [
- 0
], - "months": [
- "MAR"
]
}, - "attribution-actor": "current",
- "parameters": {
- "deploy_prod": true,
- "branch": "feature/design-new-api"
}
}
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "timetable": {
- "per-hour": 0,
- "hours-of-day": [
- 0
], - "days-of-week": [
- "TUE"
], - "days-of-month": [
- 0
], - "months": [
- "MAR"
]
}, - "updated-at": "2019-08-24T14:15:22Z",
- "name": "string",
- "created-at": "2019-08-24T14:15:22Z",
- "project-slug": "gh/CircleCI-Public/api-preview-docs",
- "parameters": {
- "deploy_prod": true,
- "branch": "feature/design-new-api"
}, - "actor": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "login": "string",
- "name": "string"
}, - "description": "string"
}
Get a schedule by id.
schedule-id required | string <uuid> The unique ID of the schedule. |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/schedule/%7Bschedule-id%7D', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "timetable": {
- "per-hour": 0,
- "hours-of-day": [
- 0
], - "days-of-week": [
- "TUE"
], - "days-of-month": [
- 0
], - "months": [
- "MAR"
]
}, - "updated-at": "2019-08-24T14:15:22Z",
- "name": "string",
- "created-at": "2019-08-24T14:15:22Z",
- "project-slug": "gh/CircleCI-Public/api-preview-docs",
- "parameters": {
- "deploy_prod": true,
- "branch": "feature/design-new-api"
}, - "actor": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "login": "string",
- "name": "string"
}, - "description": "string"
}
Not yet available to projects that use GitLab or GitHub App. Deletes the schedule by id.
schedule-id required | string <uuid> The unique ID of the schedule. |
const request = require('request'); const options = { method: 'DELETE', url: 'https://circleci.com/api/v2/schedule/%7Bschedule-id%7D', headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "message": "string"
}