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: {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",
- "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) |
const request = require('request'); const options = { method: 'GET', url: 'https://circleci.com/api/v2/context/%7Bcontext-id%7D/environment-variable', 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",
- "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",
- "context_id": "f31d7249-b7b1-4729-b3a4-ec0ba07b4686"
}
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. Metrics are refreshed daily, and thus may not include executions from the last 24 hours. Please note that Insights is not a real time financial reporting tool and should not be used for credit reporting. The most up to date credit information can be found in Plan Overview 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. |
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,
- "throughput": 0
}, - "trends": {
- "total_runs": 0,
- "total_duration_secs": 0,
- "total_credits_used": 0,
- "success_rate": 0,
- "throughput": 0
}
}, - "project_workflow_data": [
- {
- "workflow_name": "build-and-test",
- "metrics": {
- "total_credits_used": 0,
- "p95_duration_secs": 0,
- "total_runs": 0,
- "success_rate": 0
}, - "trends": {
- "total_credits_used": 0,
- "p95_duration_secs": 0,
- "total_runs": 0,
- "success_rate": 0
}
}
], - "project_workflow_branch_data": [
- {
- "workflow_name": "build-and-test",
- "branch": "main",
- "metrics": {
- "total_credits_used": 0,
- "p95_duration_secs": 0,
- "total_runs": 0,
- "success_rate": 0
}, - "trends": {
- "total_credits_used": 0,
- "p95_duration_secs": 0,
- "total_runs": 0,
- "success_rate": 0
}
}
], - "all_branches": [
- "main"
], - "all_workflows": [
- "build-and-test"
]
}
Get timeseries data for all jobs within a workflow.
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. |
timeseries-granularity | string Enum: "daily" "hourly" Example: timeseries-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', 'timeseries-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,
- "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. |
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,
- "throughput": 0
}, - "trends": {
- "total_runs": 0,
- "total_duration_secs": 0,
- "total_credits_used": 0,
- "success_rate": 0,
- "throughput": 0
}
}, - "org_project_data": [
- {
- "project_name": "api-preview-docs",
- "metrics": {
- "total_credits_used": 0,
- "total_duration_secs": 0,
- "total_runs": 0,
- "success_rate": 0
}, - "trends": {
- "total_credits_used": 0,
- "total_duration_secs": 0,
- "total_runs": 0,
- "success_rate": 0
}
}
], - "all_projects": [
- "string"
]
}
Get a list of all branches for a specified project. The list will only contain branches currently available within Insights.
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); });
null
Get a list of flaky tests for a given project. Flaky tests are branch agnostic. A flaky test is a test that passed and faliled 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": null,
- "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"
}
]
}
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 real time financial reporting tool and should not be used for credit reporting. The most up to date credit information can be found in Plan Overview 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. |
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",
- "window_start": "2019-08-24T14:15:22Z",
- "window_end": "2019-08-24T14:15:22Z",
- "metrics": {
- "total_runs": 0,
- "successful_runs": 0,
- "mttr": 0,
- "total_credits_used": 0,
- "failed_runs": 0,
- "success_rate": 0,
- "duration_metrics": {
- "min": 0,
- "mean": 0,
- "median": 0,
- "p95": 0,
- "max": 0,
- "standard_deviation": 0
}, - "total_recoveries": 0,
- "throughput": 0
}
}
], - "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 real time financial reporting tool and should not be used for credit reporting. The most up to date credit information can be found in Plan Overview 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"
}
], - "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 real time financial reporting tool and should not be used for credit reporting. The most up to date credit information can be found in Plan Overview 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. |
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' }, headers: {authorization: 'Basic REPLACE_BASIC_AUTH'} }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
{- "items": [
- {
- "name": "string",
- "window_start": "2019-08-24T14:15:22Z",
- "window_end": "2019-08-24T14:15:22Z",
- "metrics": {
- "success_rate": 0,
- "total_runs": 0,
- "failed_runs": 0,
- "successful_runs": 0,
- "throughput": 0,
- "total_credits_used": 0,
- "duration_metrics": {
- "min": 0,
- "mean": 0,
- "median": 0,
- "p95": 0,
- "max": 0,
- "standard_deviation": 0
}
}
}
], - "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. |
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. |
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', branches: 'SOME_OBJECT_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,
- "window_start": "2019-08-24T14:15:22Z",
- "duration_metrics": {
- "min": 0,
- "mean": 0,
- "median": 0,
- "p95": 0,
- "max": 0,
- "standard_deviation": 0
}, - "window_end": "2019-08-24T14:15:22Z",
- "throughput": 0
}, - "trends": {
- "total_runs": 0,
- "failed_runs": 0,
- "success_rate": 0,
- "p95_duration_secs": 0,
- "median_duration_secs": 0,
- "total_credits_used": 0,
- "mttr": 0,
- "throughput": 0
}, - "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,
- "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,
- "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,
- "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"
}
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.
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. |
{- "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 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"
}
Triggers a new pipeline on the project.
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. |
{- "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"
},
}
}
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": 0,
- "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"
}
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": 0,
- "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> 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"
}
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 This is a 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 webhook 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"
}
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 This is a 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"
]
}
Get a 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"
]
}
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"
}
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": "master"
}
}
Returns a sequence of checkout keys for :project
.
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/checkout-key', 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"
}
Creates a new checkout key. This API request is only usable with a user API token.
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.
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.
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"
}
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"
}
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"
}
], - "next_page_token": "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"
}
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 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"
], - "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"
}
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 Description of the schedule. |
{- "name": "string",
- "timetable": {
- "per-hour": 0,
- "hours-of-day": [
- 0
], - "days-of-week": [
- "TUE"
], - "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"
], - "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"
}
Updates a schedule and returns the updated schedule.
schedule-id required | string <uuid> The unique ID of the schedule. |
description | string Description of the schedule. |
name | string Name of the schedule. |
object or 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"
], - "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"
], - "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"
], - "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"
}
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"
}