CircleCI Context API
Endpoints for managing contexts, which are used to secure and share environment variables across projects.
Endpoints for managing contexts, which are used to secure and share environment variables across projects.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/circleci-context-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: CircleCI REST API v2 Context API
description: The CircleCI REST API v2 provides programmatic access to CircleCI services for managing pipelines, projects, workflows, jobs, and users. Developers can trigger pipelines, retrieve build status, manage contexts and environment variables, and access usage reports. The API uses token-based authentication via a Circle-Token header and returns JSON responses. It supports operations for project configuration, workflow management, artifact retrieval, and insights into build performance.
version: '2.0'
contact:
name: CircleCI Support
url: https://support.circleci.com
termsOfService: https://circleci.com/terms-of-service/
license:
name: MIT
url: https://opensource.org/licenses/MIT
servers:
- url: https://circleci.com/api/v2
description: CircleCI Production API
security:
- apiToken: []
tags:
- name: Context
description: Endpoints for managing contexts, which are used to secure and share environment variables across projects.
paths:
/context:
get:
operationId: listContexts
summary: List contexts
description: Returns a paginated list of contexts for a given owner, which can be an organization or account.
tags:
- Context
parameters:
- $ref: '#/components/parameters/OwnerIdParam'
- $ref: '#/components/parameters/OwnerSlugParam'
- $ref: '#/components/parameters/OwnerTypeParam'
- $ref: '#/components/parameters/PageTokenParam'
responses:
'200':
description: Successfully retrieved contexts
content:
application/json:
schema:
$ref: '#/components/schemas/ContextList'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
post:
operationId: createContext
summary: Create a context
description: Creates a new context for sharing environment variables across projects.
tags:
- Context
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateContextRequest'
responses:
'200':
description: Successfully created context
content:
application/json:
schema:
$ref: '#/components/schemas/Context'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/context/{context-id}:
get:
operationId: getContext
summary: Get a context
description: Returns a specific context by its unique identifier.
tags:
- Context
parameters:
- $ref: '#/components/parameters/ContextIdParam'
responses:
'200':
description: Successfully retrieved context
content:
application/json:
schema:
$ref: '#/components/schemas/Context'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Context not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
delete:
operationId: deleteContext
summary: Delete a context
description: Deletes a context and all of its associated environment variables.
tags:
- Context
parameters:
- $ref: '#/components/parameters/ContextIdParam'
responses:
'200':
description: Successfully deleted context
content:
application/json:
schema:
$ref: '#/components/schemas/MessageResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Context not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/context/{context-id}/environment-variable:
get:
operationId: listContextEnvironmentVariables
summary: List environment variables in a context
description: Returns a paginated list of environment variables associated with a specific context.
tags:
- Context
parameters:
- $ref: '#/components/parameters/ContextIdParam'
- $ref: '#/components/parameters/PageTokenParam'
responses:
'200':
description: Successfully retrieved environment variables
content:
application/json:
schema:
$ref: '#/components/schemas/EnvironmentVariableList'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/context/{context-id}/environment-variable/{env-var-name}:
put:
operationId: addOrUpdateContextEnvironmentVariable
summary: Add or update an environment variable
description: Creates a new environment variable or updates an existing one within the specified context.
tags:
- Context
parameters:
- $ref: '#/components/parameters/ContextIdParam'
- $ref: '#/components/parameters/EnvVarNameParam'
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- value
properties:
value:
type: string
description: The value of the environment variable
responses:
'200':
description: Successfully added or updated environment variable
content:
application/json:
schema:
$ref: '#/components/schemas/EnvironmentVariable'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
delete:
operationId: deleteContextEnvironmentVariable
summary: Remove an environment variable
description: Deletes an environment variable from the specified context.
tags:
- Context
parameters:
- $ref: '#/components/parameters/ContextIdParam'
- $ref: '#/components/parameters/EnvVarNameParam'
responses:
'200':
description: Successfully deleted environment variable
content:
application/json:
schema:
$ref: '#/components/schemas/MessageResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
EnvironmentVariableList:
type: object
properties:
items:
type: array
items:
$ref: '#/components/schemas/EnvironmentVariable'
description: List of environment variables
next_page_token:
type: string
description: Token for retrieving the next page
EnvironmentVariable:
type: object
properties:
variable:
type: string
description: The name of the environment variable
created_at:
type: string
format: date-time
description: When the variable was created
updated_at:
type: string
format: date-time
description: When the variable was last updated
context_id:
type: string
format: uuid
description: The ID of the context this variable belongs to
MessageResponse:
type: object
properties:
message:
type: string
description: A message describing the result of the operation
CreateContextRequest:
type: object
required:
- name
- owner
properties:
name:
type: string
description: The name of the context
owner:
type: object
required:
- id
- type
properties:
id:
type: string
format: uuid
description: The owner ID
type:
type: string
enum:
- account
- organization
description: The owner type
ErrorResponse:
type: object
properties:
message:
type: string
description: A human-readable error message
ContextList:
type: object
properties:
items:
type: array
items:
$ref: '#/components/schemas/Context'
description: List of contexts
next_page_token:
type: string
description: Token for retrieving the next page
Context:
type: object
properties:
id:
type: string
format: uuid
description: The unique identifier of the context
name:
type: string
description: The name of the context
created_at:
type: string
format: date-time
description: When the context was created
parameters:
ContextIdParam:
name: context-id
in: path
required: true
description: The unique identifier of the context
schema:
type: string
format: uuid
OwnerTypeParam:
name: owner-type
in: query
description: The type of the owner
schema:
type: string
enum:
- account
- organization
EnvVarNameParam:
name: env-var-name
in: path
required: true
description: The name of the environment variable
schema:
type: string
OwnerSlugParam:
name: owner-slug
in: query
description: The slug for the owner
schema:
type: string
PageTokenParam:
name: page-token
in: query
description: Token for retrieving the next page of results
schema:
type: string
OwnerIdParam:
name: owner-id
in: query
description: The unique identifier of the owner
schema:
type: string
format: uuid
securitySchemes:
apiToken:
type: apiKey
in: header
name: Circle-Token
description: Personal API token for authenticating with the CircleCI API. Generate tokens in your CircleCI account settings.
basicAuth:
type: http
scheme: basic
description: HTTP basic authentication using a personal API token as the username with an empty password.
externalDocs:
description: CircleCI API v2 Documentation
url: https://circleci.com/docs/api/v2/