Download OpenAPI specification:Download
This document outlines the endpoints and resources that are a part of the CircleCI API v2.
[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. |
{- "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. |
{- "message": "Context restriction deleted."
}
[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 |
{- "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 |
{- "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. |
{- "usage_export_job_id": "7cd4bded-f639-433a-876b-1a8ea9f53127",
- "state": "created",
- "error_reason": "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"
}