@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api CircleCI API
@base https://circleci.com/api/v2
@version v2
@auth ApiKey Circle-Token in header | Basic | ApiKey circle-token in query
@endpoints 113
@hint download_for_search
@toc insights(10), jobs(1), me(2), organization(7), pipeline(6), project(23), schedule(3), user(1), webhook(5), workflow(5), org(6), owner(9), context(10), organizations(6), projects(11), deploy(5), otel(3)

@group insights
@endpoint GET /insights/pages/{project-slug}/summary
@required {project-slug: str}
@optional {reporting-window: str(last-7-days/last-90-days/last-24-hours/last-30-days/last-60-days), branches: map, workflow-names: map}
@returns(200) {org_id: any, project_id: any, project_data: map{metrics: map{total_runs: int(int64), total_duration_secs: int(int64), total_credits_used: int(int64), success_rate: num(float), throughput: num(float)}, trends: map{total_runs: num(float), total_duration_secs: num(float), total_credits_used: num(float), success_rate: num(float), throughput: num(float)}}, project_workflow_data: [map], project_workflow_branch_data: [map], all_branches: [str], all_workflows: [str]}

@endpoint GET /insights/time-series/{project-slug}/workflows/{workflow-name}/jobs
@required {project-slug: str, workflow-name: str}
@optional {branch: str, granularity: str(daily/hourly), start-date: str(date-time), end-date: str(date-time)}
@returns(200) {next_page_token: str, items: [map]}

@endpoint GET /insights/{org-slug}/summary
@required {org-slug: str}
@optional {reporting-window: str(last-7-days/last-90-days/last-24-hours/last-30-days/last-60-days), project-names: map}
@returns(200) {org_data: map{metrics: map{total_runs: int(int64), total_duration_secs: int(int64), total_credits_used: int(int64), success_rate: num(float), throughput: num(float)}, trends: map{total_runs: num(float), total_duration_secs: num(float), total_credits_used: num(float), success_rate: num(float), throughput: num(float)}}, org_project_data: [map], all_projects: [str]}

@endpoint GET /insights/{project-slug}/branches
@required {project-slug: str}
@optional {workflow-name: str}
@returns(200) {org_id: any, project_id: any, branches: [str]}

@endpoint GET /insights/{project-slug}/flaky-tests
@required {project-slug: str}
@returns(200) {flaky-tests: [map], total-flaky-tests: num(double)}

@endpoint GET /insights/{project-slug}/workflows
@required {project-slug: str}
@optional {page-token: str, all-branches: bool, branch: str, reporting-window: str(last-7-days/last-90-days/last-24-hours/last-30-days/last-60-days)}
@returns(200) {items: [map], next_page_token: str}

@endpoint GET /insights/{project-slug}/workflows/{workflow-name}
@required {project-slug: str, workflow-name: str}
@optional {all-branches: bool, branch: str, page-token: str, start-date: str(date-time), end-date: str(date-time)}
@returns(200) {items: [map], next_page_token: str}

@endpoint GET /insights/{project-slug}/workflows/{workflow-name}/jobs
@required {project-slug: str, workflow-name: str}
@optional {page-token: str, all-branches: bool, branch: str, reporting-window: str(last-7-days/last-90-days/last-24-hours/last-30-days/last-60-days), job-name: str}
@returns(200) {items: [map], next_page_token: str}

@endpoint GET /insights/{project-slug}/workflows/{workflow-name}/summary
@required {project-slug: str, workflow-name: str}
@optional {all-branches: bool, branch: str}
@returns(200) {metrics: map{total_runs: int(int64), successful_runs: int(int64), mttr: int(int64), total_credits_used: int(int64), failed_runs: int(int64), success_rate: num(float), completed_runs: int(int64), window_start: str(date-time), duration_metrics: map{min: int(int64), mean: int(int64), median: int(int64), p95: int(int64), max: int(int64), standard_deviation: num(float)}, window_end: str(date-time), throughput: num(float)}, trends: map{total_runs: num(float), failed_runs: num(float), success_rate: num(float), p95_duration_secs: num(float), median_duration_secs: num(float), total_credits_used: num(float), mttr: num(float), throughput: num(float)}, workflow_names: [str]}

@endpoint GET /insights/{project-slug}/workflows/{workflow-name}/test-metrics
@required {project-slug: str, workflow-name: str}
@optional {branch: str, all-branches: bool}
@returns(200) {average_test_count: int(int64), most_failed_tests: [map], most_failed_tests_extra: int(int64), slowest_tests: [map], slowest_tests_extra: int(int64), total_test_runs: int(int64), test_runs: [map]}

@endgroup

@group jobs
@endpoint POST /jobs/{job-id}/cancel
@required {job-id: str(uuid)}
@returns(200) {message: str}
@errors {400, 401, 403, 404}

@endgroup

@group me
@endpoint GET /me
@returns(200) {avatar_url: str, id: str(uuid), login: str, name: str}

@endpoint GET /me/collaborations
@returns(200)

@endgroup

@group organization
@endpoint POST /organization
@required {name: str, vcs_type: str(github/bitbucket/circleci)}
@returns(201) {id: str, name: str, slug: str, vcs_type: str}

@endpoint DELETE /organization/{org-slug-or-id}
@required {org-slug-or-id: str}
@returns(202) {message: str}

@endpoint GET /organization/{org-slug-or-id}
@required {org-slug-or-id: str}
@returns(200) {id: str, name: str, slug: str, vcs_type: str}

@endpoint POST /organization/{org-slug-or-id}/project
@required {org-slug-or-id: str, name: str}
@returns(200) {slug: str, name: str, id: str(uuid), organization_name: str, organization_slug: str, organization_id: str(uuid), vcs_info: map{vcs_url: str, provider: str, default_branch: str}}

@endpoint POST /organization/{org-slug-or-id}/url-orb-allow-list
@required {org-slug-or-id: str, name: str, prefix: any, auth: str(github-oauth/none/bitbucket-oauth/github-app)}
@returns(200) {id: str, message: str}

@endpoint GET /organization/{org-slug-or-id}/url-orb-allow-list
@required {org-slug-or-id: str}
@returns(200) {items: [map]}

@endpoint DELETE /organization/{org-slug-or-id}/url-orb-allow-list/{allow-list-entry-id}
@required {org-slug-or-id: str, allow-list-entry-id: str}
@returns(200) {id: str, message: str}

@endgroup

@group pipeline
@endpoint GET /pipeline
@optional {org-slug: str, page-token: str, mine: bool}
@returns(200) {items: [map], next_page_token: str}

@endpoint POST /pipeline/continue
@required {continuation-key: str, configuration: str}
@optional {parameters: map}
@returns(200) {message: str}

@endpoint GET /pipeline/{pipeline-id}
@required {pipeline-id: str(uuid)}
@returns(200) {id: str(uuid), errors: [map], project_slug: str, updated_at: str(date-time), number: int(int64), trigger_parameters: map, state: str, created_at: str(date-time), trigger: map{type: str, received_at: str(date-time), actor: map{login: str, avatar_url: str}}, vcs: map{provider_name: str, target_repository_url: str, branch: str, review_id: str, review_url: str, revision: str, tag: str, commit: map{subject: str, body: str}, origin_repository_url: str}}

@endpoint GET /pipeline/{pipeline-id}/config
@required {pipeline-id: str(uuid)}
@returns(200) {source: str, compiled: str, setup-config: str, compiled-setup-config: str}

@endpoint GET /pipeline/{pipeline-id}/values
@required {pipeline-id: str(uuid)}
@returns(200)

@endpoint GET /pipeline/{pipeline-id}/workflow
@required {pipeline-id: str(uuid)}
@optional {page-token: str}
@returns(200) {items: [map], next_page_token: str}

@endgroup

@group project
@endpoint GET /project/{project-slug}
@required {project-slug: str}
@returns(200) {slug: str, name: str, id: str(uuid), organization_name: str, organization_slug: str, organization_id: str(uuid), vcs_info: map{vcs_url: str, provider: str, default_branch: str}}

@endpoint DELETE /project/{project-slug}
@required {project-slug: str}
@returns(200) {message: str}

@endpoint GET /project/{project-slug}/checkout-key
@required {project-slug: str}
@optional {digest: str(sha256/md5)}
@returns(200) {items: [map], next_page_token: str}

@endpoint POST /project/{project-slug}/checkout-key
@required {project-slug: str, type: str(user-key/deploy-key)}
@returns(201) {public-key: str, type: str, fingerprint: str, preferred: bool, created-at: str(date-time)}

@endpoint DELETE /project/{project-slug}/checkout-key/{fingerprint}
@required {project-slug: str, fingerprint: str}
@returns(200) {message: str}

@endpoint GET /project/{project-slug}/checkout-key/{fingerprint}
@required {project-slug: str, fingerprint: str}
@returns(200) {public-key: str, type: str, fingerprint: str, preferred: bool, created-at: str(date-time)}

@endpoint GET /project/{project-slug}/envvar
@required {project-slug: str}
@returns(200) {items: [map], next_page_token: str}

@endpoint POST /project/{project-slug}/envvar
@required {project-slug: str, name: str, value: str}
@returns(201) {name: str, value: str, created-at: any}

@endpoint GET /project/{project-slug}/envvar/{name}
@required {project-slug: str, name: str}
@returns(200) {name: str, value: str, created-at: any}

@endpoint DELETE /project/{project-slug}/envvar/{name}
@required {project-slug: str, name: str}
@returns(200) {message: str}

@endpoint GET /project/{project-slug}/job/{job-number}
@required {job-number: any, project-slug: str}
@returns(200) {web_url: str, project: map{id: str(uuid), slug: str, name: str, external_url: str}, parallel_runs: [map], started_at: str(date-time), latest_workflow: map{id: str(uuid), name: str}, name: str, executor: map{resource_class: str, type: str}, parallelism: int(int64), status: str, number: int(int64), pipeline: map{id: str(uuid)}, duration: int(int64), created_at: str(date-time), messages: [map], contexts: [map], organization: map{name: str}, queued_at: str(date-time), stopped_at: str(date-time)}

@endpoint POST /project/{project-slug}/job/{job-number}/cancel
@required {job-number: any, project-slug: str}
@returns(200) {message: str}

@endpoint POST /project/{project-slug}/pipeline
@required {project-slug: str}
@optional {branch: str, tag: str, parameters: map}
@returns(201) {id: str(uuid), state: str, number: int(int64), created_at: str(date-time)}

@endpoint GET /project/{project-slug}/pipeline
@required {project-slug: str}
@optional {branch: str, page-token: str}
@returns(200) {items: [map], next_page_token: str}

@endpoint GET /project/{project-slug}/pipeline/mine
@required {project-slug: str}
@optional {page-token: str}
@returns(200) {items: [map], next_page_token: str}

@endpoint GET /project/{project-slug}/pipeline/{pipeline-number}
@required {project-slug: str, pipeline-number: any}
@returns(200) {id: str(uuid), errors: [map], project_slug: str, updated_at: str(date-time), number: int(int64), trigger_parameters: map, state: str, created_at: str(date-time), trigger: map{type: str, received_at: str(date-time), actor: map{login: str, avatar_url: str}}, vcs: map{provider_name: str, target_repository_url: str, branch: str, review_id: str, review_url: str, revision: str, tag: str, commit: map{subject: str, body: str}, origin_repository_url: str}}

@endpoint GET /project/{project-slug}/schedule
@required {project-slug: str}
@optional {page-token: str}
@returns(200) {items: [map], next_page_token: str}

@endpoint POST /project/{project-slug}/schedule
@required {project-slug: str, name: str, timetable: any, attribution-actor: str(current/system), parameters: map}
@optional {description: str}
@returns(201) {id: str(uuid), timetable: any, updated-at: str(date-time), name: str, created-at: str(date-time), project-slug: str, parameters: map, actor: map{avatar_url: str, id: str(uuid), login: str, name: str}, description: str}

@endpoint GET /project/{project-slug}/{job-number}/artifacts
@required {job-number: any, project-slug: str}
@returns(200) {items: [map], next_page_token: str}

@endpoint GET /project/{project-slug}/{job-number}/tests
@required {job-number: any, project-slug: str}
@returns(200) {items: [map], next_page_token: str}

@endgroup

@group schedule
@endpoint DELETE /schedule/{schedule-id}
@required {schedule-id: str(uuid)}
@returns(200) {message: str}

@endpoint GET /schedule/{schedule-id}
@required {schedule-id: str(uuid)}
@returns(200) {id: str(uuid), timetable: any, updated-at: str(date-time), name: str, created-at: str(date-time), project-slug: str, parameters: map, actor: map{avatar_url: str, id: str(uuid), login: str, name: str}, description: str}

@endpoint PATCH /schedule/{schedule-id}
@required {schedule-id: str(uuid)}
@optional {description: str, name: str, timetable: map{per-hour: int(integer), hours-of-day: [int(integer)], days-of-week: [str], days-of-month: [int(integer)], months: [str]}, attribution-actor: str(current/system), parameters: map}
@returns(200) {id: str(uuid), timetable: any, updated-at: str(date-time), name: str, created-at: str(date-time), project-slug: str, parameters: map, actor: map{avatar_url: str, id: str(uuid), login: str, name: str}, description: str}

@endgroup

@group user
@endpoint GET /user/{id}
@required {id: str(uuid)}
@returns(200) {avatar_url: str, id: str(uuid), login: str, name: str}

@endgroup

@group webhook
@endpoint POST /webhook
@required {name: str, events: [str], url: str, verify-tls: bool, signing-secret: str, scope: map{id!: str(uuid), type!: str}}
@returns(201) {url: str, verify-tls: bool, id: str(uuid), signing-secret: str, updated-at: str(date-time), name: str, created-at: str(date-time), scope: map{id: str(uuid), type: str}, events: [str]}

@endpoint GET /webhook
@required {scope-id: str(uuid), scope-type: str}
@returns(200) {items: [map], next_page_token: str}

@endpoint PUT /webhook/{webhook-id}
@required {webhook-id: str(uuid)}
@optional {name: str, events: [str], url: str, signing-secret: str, verify-tls: bool}
@returns(200) {url: str, verify-tls: bool, id: str(uuid), signing-secret: str, updated-at: str(date-time), name: str, created-at: str(date-time), scope: map{id: str(uuid), type: str}, events: [str]}

@endpoint GET /webhook/{webhook-id}
@required {webhook-id: str(uuid)}
@returns(200) {url: str, verify-tls: bool, id: str(uuid), signing-secret: str, updated-at: str(date-time), name: str, created-at: str(date-time), scope: map{id: str(uuid), type: str}, events: [str]}

@endpoint DELETE /webhook/{webhook-id}
@required {webhook-id: str(uuid)}
@returns(200) {message: str}

@endgroup

@group workflow
@endpoint GET /workflow/{id}
@required {id: str(uuid)}
@returns(200) {pipeline_id: str(uuid), canceled_by: str(uuid), id: str(uuid), auto_rerun_number: int(int64), name: str, project_slug: str, errored_by: str(uuid), tag: str, status: str, started_by: str(uuid), max_auto_reruns: int(int64), pipeline_number: int(int64), created_at: str(date-time), stopped_at: str(date-time)}

@endpoint POST /workflow/{id}/approve/{approval_request_id}
@required {approval_request_id: str(uuid), id: str(uuid)}
@returns(202) {message: str}

@endpoint POST /workflow/{id}/cancel
@required {id: str(uuid)}
@returns(202) {message: str}

@endpoint GET /workflow/{id}/job
@required {id: str(uuid)}
@returns(200) {items: [map], next_page_token: str}

@endpoint POST /workflow/{id}/rerun
@required {id: str(uuid)}
@optional {enable_ssh: bool, from_failed: bool, jobs: [str(uuid)], sparse_tree: bool}
@returns(202) {workflow_id: str(uuid)}

@endgroup

@group org
@endpoint DELETE /org/{orgID}/oidc-custom-claims
@required {orgID: str(uuid), claims: str}
@returns(200) {audience: [str], audience_updated_at: str(date-time), org_id: str(uuid), project_id: str(uuid), ttl: str, ttl_updated_at: str(date-time)}
@errors {400, 403, 500}

@endpoint GET /org/{orgID}/oidc-custom-claims
@required {orgID: str(uuid)}
@returns(200) {audience: [str], audience_updated_at: str(date-time), org_id: str(uuid), project_id: str(uuid), ttl: str, ttl_updated_at: str(date-time)}
@errors {400, 403, 500}

@endpoint PATCH /org/{orgID}/oidc-custom-claims
@required {orgID: str(uuid)}
@optional {audience: [str], ttl: str}
@returns(200) {audience: [str], audience_updated_at: str(date-time), org_id: str(uuid), project_id: str(uuid), ttl: str, ttl_updated_at: str(date-time)}
@errors {400, 403, 500}

@endpoint DELETE /org/{orgID}/project/{projectID}/oidc-custom-claims
@required {orgID: str(uuid), projectID: str(uuid), claims: str}
@returns(200) {audience: [str], audience_updated_at: str(date-time), org_id: str(uuid), project_id: str(uuid), ttl: str, ttl_updated_at: str(date-time)}
@errors {400, 403, 500}

@endpoint GET /org/{orgID}/project/{projectID}/oidc-custom-claims
@required {orgID: str(uuid), projectID: str(uuid)}
@returns(200) {audience: [str], audience_updated_at: str(date-time), org_id: str(uuid), project_id: str(uuid), ttl: str, ttl_updated_at: str(date-time)}
@errors {400, 403, 500}

@endpoint PATCH /org/{orgID}/project/{projectID}/oidc-custom-claims
@required {orgID: str(uuid), projectID: str(uuid)}
@optional {audience: [str], ttl: str}
@returns(200) {audience: [str], audience_updated_at: str(date-time), org_id: str(uuid), project_id: str(uuid), ttl: str, ttl_updated_at: str(date-time)}
@errors {400, 403, 500}

@endgroup

@group owner
@endpoint GET /owner/{ownerID}/context/{context}/decision
@required {ownerID: str, context: str}
@optional {status: str, after: str(date-time), before: str(date-time), branch: str, project_id: str, build_number: str, offset: int}
@returns(200)
@errors {400, 401, 403, 500}

@endpoint POST /owner/{ownerID}/context/{context}/decision
@required {ownerID: str, context: str, input: str}
@optional {metadata: map}
@returns(200) {enabled_rules: [str], hard_failures: [map], reason: str, soft_failures: [map], status: str}
@errors {400, 401, 500}

@endpoint GET /owner/{ownerID}/context/{context}/decision/settings
@required {ownerID: str, context: str}
@returns(200) {enabled: bool}
@errors {400, 401, 403, 500}

@endpoint PATCH /owner/{ownerID}/context/{context}/decision/settings
@required {ownerID: str, context: str}
@optional {enabled: bool}
@returns(200) {enabled: bool}
@errors {400, 401, 403, 500}

@endpoint GET /owner/{ownerID}/context/{context}/decision/{decisionID}
@required {ownerID: str, context: str, decisionID: str}
@returns(200) {created_at: str(date-time), decision: map{enabled_rules: [str], hard_failures: [map], reason: str, soft_failures: [map], status: str}, id: str(uuid), metadata: map{build_number: int, project_id: str(uuid), ssh_rerun: bool, vcs: map{branch: str, origin_repository_url: str, release_tag: str, target_repository_url: str}}, policies: map, time_taken_ms: int}
@errors {400, 401, 403, 404, 500}

@endpoint GET /owner/{ownerID}/context/{context}/decision/{decisionID}/policy-bundle
@required {ownerID: str, context: str, decisionID: str}
@returns(200)
@errors {400, 401, 403, 404, 500}

@endpoint GET /owner/{ownerID}/context/{context}/policy-bundle
@required {ownerID: str, context: str}
@returns(200)
@errors {400, 401, 403, 500}

@endpoint POST /owner/{ownerID}/context/{context}/policy-bundle
@required {ownerID: str, context: str}
@optional {dry: bool, policies: map}
@returns(200) {created: [str], deleted: [str], modified: [str]}
@returns(201) {created: [str], deleted: [str], modified: [str]}
@errors {400, 401, 403, 413, 500}

@endpoint GET /owner/{ownerID}/context/{context}/policy-bundle/{policyName}
@returns(200) {content: str, created_at: str(date-time), created_by: str, name: str}
@errors {400, 401, 403, 404, 500}

@endgroup

@group context
@endpoint POST /context
@required {name: str, owner: any}
@returns(200) {id: str(uuid), name: str, created_at: str(date-time)}
@errors {401, 404, 429, 500}

@endpoint GET /context
@optional {owner-id: str(uuid), owner-slug: str, owner-type: str(account/organization), page-token: str}
@returns(200) {items: [map], next_page_token: str?}
@errors {401, 404, 429, 500}

@endpoint GET /context/{context_id}
@required {context_id: str(uuid)}
@returns(200) {id: str(uuid), name: str, created_at: str(date-time)}
@errors {401, 404, 429, 500}

@endpoint DELETE /context/{context_id}
@required {context_id: str(uuid)}
@returns(200) {message: str}
@errors {401, 404, 429, 500}

@endpoint GET /context/{context_id}/environment-variable
@required {context_id: str(uuid)}
@optional {page-token: str}
@returns(200) {items: [map], next_page_token: str?}
@errors {401, 404, 429, 500}

@endpoint PUT /context/{context_id}/environment-variable/{env_var_name}
@required {context_id: str(uuid), env_var_name: str, value: str}
@returns(200)
@errors {401, 404, 429, 500}

@endpoint DELETE /context/{context_id}/environment-variable/{env_var_name}
@required {context_id: str(uuid), env_var_name: str}
@returns(200) {message: str}
@errors {401, 404, 429, 500}

@endpoint GET /context/{context_id}/restrictions
@returns(200) {items: [any], next_page_token: str?}
@errors {400, 401, 404, 429, 500}

@endpoint POST /context/{context_id}/restrictions
@optional {restriction_type: str(project/expression/group), restriction_value: str}
@returns(201) {id: str(uuid), project_id: str(uuid), name: str, restriction_type: str, restriction_value: str}
@errors {400, 401, 404, 409, 429, 500}

@endpoint DELETE /context/{context_id}/restrictions/{restriction_id}
@returns(200) {message: str}
@errors {400, 401, 404, 429, 500}

@endgroup

@group project
@endpoint GET /project/{provider}/{organization}/{project}/settings
@returns(200) {advanced: map{autocancel_builds: bool, build_fork_prs: bool, build_prs_only: bool, disable_ssh: bool, forks_receive_secret_env_vars: bool, oss: bool, set_github_status: bool, setup_workflows: bool, write_settings_requires_admin: bool, pr_only_branch_overrides: [str]}}
@errors {401, 403, 404, 429, 500}

@endpoint PATCH /project/{provider}/{organization}/{project}/settings
@optional {advanced: map{autocancel_builds: bool, build_fork_prs: bool, build_prs_only: bool, disable_ssh: bool, forks_receive_secret_env_vars: bool, oss: bool, set_github_status: bool, setup_workflows: bool, write_settings_requires_admin: bool, pr_only_branch_overrides: [str]}}
@returns(200) {advanced: map{autocancel_builds: bool, build_fork_prs: bool, build_prs_only: bool, disable_ssh: bool, forks_receive_secret_env_vars: bool, oss: bool, set_github_status: bool, setup_workflows: bool, write_settings_requires_admin: bool, pr_only_branch_overrides: [str]}}
@errors {400, 401, 403, 404, 429, 500}

@endgroup

@group organizations
@endpoint GET /organizations/{org_id}/groups
@optional {limit: int, page-token: str}
@returns(200) {items: [map], next_page_token: str?, total_count: int}
@errors {403, 404, 500}

@endpoint POST /organizations/{org_id}/groups
@required {name: str}
@optional {description: str}
@returns(201) {id: str(uuid), name: str, description: str}
@errors {400, 401, 403, 404, 409, 500}

@endpoint GET /organizations/{org_id}/groups/{group_id}
@returns(200) {id: str(uuid), name: str, description: str}
@errors {403, 404, 500}

@endpoint DELETE /organizations/{org_id}/groups/{group_id}
@returns(200) {message: str}
@errors {401, 403, 404, 500}

@endpoint POST /organizations/{org_id}/usage_export_job
@required {start: str(date-time), end: str(date-time)}
@optional {shared_org_ids: [str(uuid)]}
@returns(201) {usage_export_job_id: str(uuid), state: str, start: str(date-time), end: str(date-time), download_urls: [str(uri)]}
@errors {400, 401, 404, 429, 500}

@endpoint GET /organizations/{org_id}/usage_export_job/{usage_export_job_id}
@returns(200) {usage_export_job_id: str(uuid), state: str, download_urls: [str(uri)], error_reason: str}
@errors {400, 401, 404, 429, 500}

@endgroup

@group project
@endpoint POST /project/{provider}/{organization}/{project}/pipeline/run
@required {provider: str(github/gh/bitbucket/bb/circleci), organization: str, project: str}
@optional {definition_id: str(uuid), config: map{branch: str, tag: str}, checkout: map{branch: str, tag: str}, parameters: map}
@returns(200) {message: str}
@returns(201) {state: str, created_at: str(date-time), number: int, id: str(uuid)}
@errors {400, 401, 404}

@endgroup

@group projects
@endpoint GET /projects/{project_id}/pipeline-definitions
@required {project_id: str}
@returns(200) {items: [map]}
@errors {400, 401, 404, 500}

@endpoint POST /projects/{project_id}/pipeline-definitions
@required {project_id: str, name: str, config_source: any, checkout_source: map{provider!: str, repo!: map{external_id!: str}}}
@optional {description: str}
@returns(200) {id: str(uuid), name: str, description: str, created_at: str(date-time), config_source: map{provider: str, repo: map{full_name: str, external_id: str}, file_path: str}, checkout_source: map{provider: str, repo: map{full_name: str, external_id: str}}}
@errors {400, 401, 404, 500}

@endpoint GET /projects/{project_id}/pipeline-definitions/{pipeline_definition_id}
@required {project_id: str, pipeline_definition_id: str}
@returns(200) {id: str(uuid), name: str, description: str, created_at: str(date-time), config_source: map{provider: str, repo: map{full_name: str, external_id: str}, file_path: str}, checkout_source: map{provider: str, repo: map{full_name: str, external_id: str}}}
@errors {400, 401, 404, 500}

@endpoint PATCH /projects/{project_id}/pipeline-definitions/{pipeline_definition_id}
@required {project_id: str, pipeline_definition_id: str}
@optional {name: str, description: str, config_source: map{file_path: str}, checkout_source: map{provider: str, repo: map{external_id: str}}}
@returns(200) {id: str(uuid), name: str, description: str, created_at: str(date-time), config_source: map{provider: str, repo: map{full_name: str, external_id: str}, file_path: str}, checkout_source: map{provider: str, repo: map{full_name: str, external_id: str}}}
@errors {400, 401, 404, 500}

@endpoint DELETE /projects/{project_id}/pipeline-definitions/{pipeline_definition_id}
@required {project_id: str, pipeline_definition_id: str}
@returns(200) {message: str}
@errors {400, 401, 404, 500}

@endpoint GET /projects/{project_id}/pipeline-definitions/{pipeline_definition_id}/triggers
@required {project_id: str, pipeline_definition_id: str}
@returns(200) {items: [map]}
@errors {400, 401, 404, 500}

@endpoint POST /projects/{project_id}/pipeline-definitions/{pipeline_definition_id}/triggers
@required {project_id: str, pipeline_definition_id: str, event_source: map{provider!: str, repo: map{external_id!: str}, webhook: map{sender: str}}}
@optional {event_preset: str(all-pushes/only-tags/default-branch-pushes/only-build-prs/only-open-prs/only-labeled-prs/only-merged-prs/only-ready-for-review-prs/only-branch-delete/only-build-pushes-to-non-draft-prs/only-merged-or-closed-prs/pr-comment-equals-run-ci/non-draft-pr-opened/pushes-to-merge-queues), checkout_ref: str, config_ref: str, event_name: str, disabled: bool}
@returns(200) {id: str(uuid), event_name: str, created_at: str(date-time), event_source: map{provider: str, repo: map{full_name: str, external_id: str}, webhook: map{url: str, sender: str}}, event_preset: str, checkout_ref: str, config_ref: str, disabled: bool}
@errors {400, 401, 404, 500}

@endpoint GET /projects/{project_id}/triggers/{trigger_id}
@required {project_id: str, trigger_id: str}
@returns(200) {id: str(uuid), event_name: str, created_at: str(date-time), event_source: map{provider: str, repo: map{full_name: str, external_id: str}, webhook: map{url: str, sender: str}}, event_preset: str, checkout_ref: str, config_ref: str, disabled: bool}
@errors {400, 401, 404, 500}

@endpoint PATCH /projects/{project_id}/triggers/{trigger_id}
@required {project_id: str, trigger_id: str}
@optional {event_preset: str(all-pushes/only-tags/default-branch-pushes/only-build-prs/only-open-prs/only-labeled-prs/only-merged-prs/only-ready-for-review-prs/only-branch-delete/only-build-pushes-to-non-draft-prs/only-merged-or-closed-prs/pr-comment-equals-run-ci/non-draft-pr-opened/pushes-to-merge-queues), checkout_ref: str, config_ref: str, event_name: str, disabled: bool, event_source: map{webhook: map{sender: str}}}
@returns(200) {id: str(uuid), event_name: str, created_at: str(date-time), event_source: map{provider: str, repo: map{full_name: str, external_id: str}, webhook: map{url: str, sender: str}}, event_preset: str, checkout_ref: str, config_ref: str, disabled: bool}
@errors {400, 401, 404, 500}

@endpoint DELETE /projects/{project_id}/triggers/{trigger_id}
@required {project_id: str, trigger_id: str}
@returns(200) {message: str}
@errors {400, 401, 404, 500}

@endpoint POST /projects/{project_id}/rollback
@required {project_id: str, component_name: str, current_version: str, environment_name: str, target_version: str}
@optional {namespace: str, parameters: map, reason: str}
@returns(202) {id: str(uuid), rollback_type: str}
@errors {400, 404, 409, 500}

@endgroup

@group deploy
@endpoint GET /deploy/environments
@required {org-id: str(uuid), page-size: int}
@optional {page-token: str}
@returns(200) {items: [map], next_page_token: str?}
@errors {400, 404, 500}

@endpoint GET /deploy/environments/{environment_id}
@required {environment_id: str(uuid)}
@returns(200) {created_at: str(date-time), description: str, id: str(uuid), labels: [map], name: str, updated_at: str(date-time)}
@errors {400, 404, 500}

@endpoint GET /deploy/components
@required {org-id: str(uuid), page-size: int}
@optional {project-id: str(uuid), page-token: str}
@returns(200) {items: [map], next_page_token: str?}
@errors {400, 404, 500}

@endpoint GET /deploy/components/{component_id}
@required {component_id: str}
@returns(200) {id: str(uuid), name: str, project_id: str(uuid), labels: [map], release_count: int, created_at: str(date-time), updated_at: str(date-time)}
@errors {400, 404, 500}

@endpoint GET /deploy/components/{component_id}/versions
@required {component_id: str}
@optional {environment-id: str(uuid)}
@returns(200) {items: [map], next_page_token: str?}
@errors {400, 404, 500}

@endgroup

@group otel
@endpoint GET /otel/exporters
@required {org-id: str(uuid)}
@returns(200)
@errors {400, 401, 404, 500}

@endpoint POST /otel/exporters
@required {org_id: str(uuid), endpoint: str, protocol: str(grpc/http)}
@optional {insecure: bool, headers: map}
@returns(201) {id: str(uuid), org_id: str(uuid), endpoint: str, protocol: str, insecure: bool, headers: map, issues: [str]}
@errors {400, 401, 404, 500}

@endpoint DELETE /otel/exporters/{otel_exporter_id}
@required {otel_exporter_id: str(uuid)}
@returns(204)
@errors {400, 401, 404, 500}

@endgroup

@end
