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 v1 Artifact Context API
description: The CircleCI REST API v1 is the legacy API that provides access to build information, project details, and user data. While still available, CircleCI recommends migrating to the v2 API for newer features and improved functionality. The v1 API supports operations for retrieving build details, triggering builds, managing SSH keys, and accessing test metadata. Authentication is handled through API tokens passed as query parameters or HTTP headers.
version: '1.1'
contact:
name: CircleCI Support
url: https://support.circleci.com
termsOfService: https://circleci.com/terms-of-service/
servers:
- url: https://circleci.com/api/v1.1
description: CircleCI Production API v1.1
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:
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
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
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
ErrorResponse:
type: object
properties:
message:
type: string
description: A human-readable error message
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
parameters:
OwnerSlugParam:
name: owner-slug
in: query
description: The slug for the owner
schema:
type: string
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
OwnerIdParam:
name: owner-id
in: query
description: The unique identifier of the owner
schema:
type: string
format: uuid
ContextIdParam:
name: context-id
in: path
required: true
description: The unique identifier of the context
schema:
type: string
format: uuid
PageTokenParam:
name: page-token
in: query
description: Token for retrieving the next page of results
schema:
type: string
securitySchemes:
apiToken:
type: apiKey
in: header
name: Circle-Token
description: Personal API token for authenticating with the CircleCI API. Can also be passed as a query parameter.
externalDocs:
description: CircleCI API v1 Reference
url: https://circleci.com/docs/api/v1/