Codefresh Contexts API

The Contexts API from Codefresh — 1 operation(s) for contexts.

GitHub OpenAPI

Operations 9

POST /contexts Create #
GET /contexts List #
GET /contexts/{name} Get #
PUT /contexts/{name} Replace #
PATCH /contexts/{name} Patch #
DELETE /contexts/{name} Delete #
POST /contexts/{name}/cache/clear Clear the git provider response cache for this context #
PATCH /contexts/{name}/default Patch #
GET /contexts/{name}/prepare Get #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • 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.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/codefresh:codefresh-contexts-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

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. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

codefresh-contexts-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  contact:
    name: Codefresh
    url: https://www.codefresh.io
  description: Codefresh API openAPI 3.0 specification
  termsOfService: https://codefresh.io/docs/docs/terms-and-privacy-policy/terms-of-service/
  title: Codefresh Contexts API
  version: 0.0.2
  x-logo:
    url: https://g.codefresh.io/modules/cf.resources/codefresh-api-docs-images/codefresh-logo-api.svg
    backgroundColor: '#FFFFFF'
    altText: Codefresh
servers:
- url: https://g.codefresh.io/api
security:
- API-key: []
tags:
- name: Contexts
  description: contexts
  x-id: contexts
paths:
  /contexts:
    post:
      x-action: createContext
      x-entityId:
        pathId: body._id
        pathName: body.metadata.name
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
          description: json
      tags:
      - Contexts
      operationId: contexts-create
      parameters:
      - in: query
        name: skipValidation
        schema:
          type: string
        description: Skip validation
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                spec:
                  type: object
                  properties:
                    data:
                      type: object
                      x-secure: true
      summary: Create
      x-sdk-interface: contexts.create
      x-code-samples:
      - lang: curl
        source: "curl  \\\n    -X POST \\\n    -H \"Authorization: ${API_KEY}\" \\\n    -H 'Content-Type: application/json; charset=utf-8' \\\n    -d \"{\\\"spec\\\":{\\\"data\\\":${DATA_OBJ}}}\" \\\n    \"https://g.codefresh.io/api/contexts?skipValidation=${SKIP_VALIDATION}\""
      - lang: node.js
        source: "sdk.contexts.create({ skipValidation }, {\n    spec: {\n        data: { ...DATA_OBJ }\n    }\n})"
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
          description: json
      tags:
      - Contexts
      operationId: contexts-list
      parameters:
      - in: query
        name: type
        schema:
          type: string
        description: Type
      - in: query
        name: decrypt
        schema:
          type: string
        description: Decrypt
      summary: List
      x-sdk-interface: contexts.list
      x-code-samples:
      - lang: curl
        source: "curl  \\\n    -X GET \\\n    -H \"Authorization: ${API_KEY}\" \\\n    \"https://g.codefresh.io/api/contexts?type=${TYPE}&decrypt=${DECRYPT}\""
      - lang: node.js
        source: sdk.contexts.list({ type, decrypt })
  /contexts/{name}:
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
          description: json
      tags:
      - Contexts
      operationId: contexts-get
      parameters:
      - in: path
        name: name
        schema:
          type: string
        required: true
        description: Name
      - in: query
        name: decrypt
        schema:
          type: string
        description: Decrypt
      summary: Get
      x-sdk-interface: contexts.get
      x-code-samples:
      - lang: curl
        source: "curl  \\\n    -X GET \\\n    -H \"Authorization: ${API_KEY}\" \\\n    \"https://g.codefresh.io/api/contexts/${NAME}?decrypt=${DECRYPT}\""
      - lang: node.js
        source: sdk.contexts.get({ name, decrypt })
    put:
      x-action: updateContext
      x-entityIdPath: params.name
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
          description: json
      tags:
      - Contexts
      operationId: contexts-replace
      parameters:
      - in: path
        name: name
        schema:
          type: string
        required: true
        description: Name
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                spec:
                  type: object
                  properties:
                    data:
                      type: object
                      x-secure: true
      summary: Replace
      x-sdk-interface: contexts.replace
      x-code-samples:
      - lang: curl
        source: "curl  \\\n    -X PUT \\\n    -H \"Authorization: ${API_KEY}\" \\\n    -H 'Content-Type: application/json; charset=utf-8' \\\n    -d \"{\\\"spec\\\":{\\\"data\\\":${DATA_OBJ}}}\" \\\n    \"https://g.codefresh.io/api/contexts/${NAME}\""
      - lang: node.js
        source: "sdk.contexts.replace({ name }, {\n    spec: {\n        data: { ...DATA_OBJ }\n    }\n})"
    patch:
      x-action: updateContext
      x-entityId:
        pathId: params.name
        handlerId: decodeContextName
        pathName: params.name
        handlerName: decodeContextName
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
          description: json
      tags:
      - Contexts
      operationId: contexts-patch
      parameters:
      - in: path
        name: name
        schema:
          type: string
        required: true
        description: Name
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                spec:
                  type: object
                  properties:
                    data:
                      type: object
                      x-secure: true
      summary: Patch
      x-sdk-interface: contexts.patch
      x-code-samples:
      - lang: curl
        source: "curl  \\\n    -X PATCH \\\n    -H \"Authorization: ${API_KEY}\" \\\n    -H 'Content-Type: application/json; charset=utf-8' \\\n    -d \"{\\\"spec\\\":{\\\"data\\\":${DATA_OBJ}}}\" \\\n    \"https://g.codefresh.io/api/contexts/${NAME}\""
      - lang: node.js
        source: "sdk.contexts.patch({ name }, {\n    spec: {\n        data: { ...DATA_OBJ }\n    }\n})"
    delete:
      x-action: deleteContext
      x-entityIdPath:
        pathName: params.name
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
          description: json
      tags:
      - Contexts
      operationId: contexts-delete
      parameters:
      - in: path
        name: name
        schema:
          type: string
        required: true
        description: Name
      summary: Delete
      x-sdk-interface: contexts.delete
      x-code-samples:
      - lang: curl
        source: "curl  \\\n    -X DELETE \\\n    -H \"Authorization: ${API_KEY}\" \\\n    \"https://g.codefresh.io/api/contexts/${NAME}\""
      - lang: node.js
        source: sdk.contexts.delete({ name })
  /contexts/{name}/cache/clear:
    post:
      x-action: clearGitContextCache
      x-record-response: true
      x-entityId:
        pathId: params.name
        handlerId: decodeContextName
        pathName: params.name
        handlerName: decodeContextName
      responses:
        '200':
          description: The cache for the context was cleared successfully
          content:
            application/json:
              schema:
                type: object
                required:
                - completed
                - keysRemoved
                properties:
                  completed:
                    type: boolean
                    description: Whether the whole cache namespace of the context was swept. When false, some entries were left in place and the clear should be retried.
                    example: true
                  keysRemoved:
                    type: integer
                    description: Number of cache entries removed by this cache clear.
                    example: 42
              example:
                completed: true
                keysRemoved: 42
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  code:
                    type: string
                  name:
                    type: string
                  message:
                    type: string
              example:
                status: 400
                code: '1004'
                name: BAD_REQUEST_ERROR
                message: Bad Request
        '404':
          description: The context was not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    format: int32
                  code:
                    type: string
                  name:
                    type: string
                  message:
                    type: string
              example:
                status: 404
                code: '1002'
                name: NOT_FOUND_ERROR
                message: Context "my-git-context" was not found
        '500':
          description: The cache clear did not complete and left entries in place, or the context could not be read
          content:
            application/json:
              schema:
                oneOf:
                - type: object
                  required:
                  - completed
                  - keysRemoved
                  properties:
                    completed:
                      type: boolean
                      description: Whether the whole cache namespace of the context was swept. When false, some entries were left in place and the clear should be retried.
                      example: true
                    keysRemoved:
                      type: integer
                      description: Number of cache entries removed by this cache clear.
                      example: 42
                - type: object
                  properties:
                    status:
                      type: integer
                      format: int32
                    code:
                      type: string
                    name:
                      type: string
                    message:
                      type: string
              example:
                completed: false
                keysRemoved: 17
      tags:
      - Contexts
      operationId: contexts-cache-clear
      parameters:
      - in: path
        name: name
        schema:
          type: string
        required: true
        description: Name
      summary: Clear the git provider response cache for this context
      x-sdk-interface: contexts.cache.clear
      x-code-samples:
      - lang: curl
        source: "curl  \\\n    -X POST \\\n    -H \"Authorization: ${API_KEY}\" \\\n    \"https://g.codefresh.io/api/contexts/${NAME}/cache/clear\""
      - lang: node.js
        source: sdk.contexts.cache.clear({ name })
  /contexts/{name}/default:
    patch:
      x-action: updateContext
      x-entityId:
        pathName: params.name
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
          description: json
      tags:
      - Contexts
      operationId: contexts-default-patch
      parameters:
      - in: path
        name: name
        schema:
          type: string
        required: true
        description: Name
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                spec:
                  type: object
                  properties:
                    data:
                      type: object
                      x-secure: true
      summary: Patch
      x-sdk-interface: contexts.default.patch
      x-code-samples:
      - lang: curl
        source: "curl  \\\n    -X PATCH \\\n    -H \"Authorization: ${API_KEY}\" \\\n    -H 'Content-Type: application/json; charset=utf-8' \\\n    -d \"{\\\"spec\\\":{\\\"data\\\":${DATA_OBJ}}}\" \\\n    \"https://g.codefresh.io/api/contexts/${NAME}/default\""
      - lang: node.js
        source: "sdk.contexts.default.patch({ name }, {\n    spec: {\n        data: { ...DATA_OBJ }\n    }\n})"
  /contexts/{name}/prepare:
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
          description: json
      tags:
      - Contexts
      operationId: contexts-prepare
      parameters:
      - in: path
        name: name
        schema:
          type: string
        required: true
        description: Name
      - in: query
        name: forceRefresh
        schema:
          type: boolean
        description: Refresh the token even if the current token is still valid
      summary: Get
      x-sdk-interface: contexts.prepare
      x-code-samples:
      - lang: curl
        source: "curl  \\\n    -X GET \\\n    -H \"Authorization: ${API_KEY}\" \\\n    \"https://g.codefresh.io/api/contexts/${NAME}/prepare?forceRefresh=${FORCE_REFRESH}\""
      - lang: node.js
        source: sdk.contexts.prepare({ name, forceRefresh })
components:
  securitySchemes:
    API-key:
      in: header
      name: Authorization
      description: 'An api key got from: User Settings -> API keys -> Generate'
      type: apiKey
x-service-name: api-public
x-base-path: /api
x-internal-services:
- pipeline-manager
- api
x-endpoint-conditions:
- weight: 0
  condition: global.has-general-service-role
  handlerRegex: (.*)
- weight: 1
  condition: global.has-kubernetes-endpoints-service-role
  handlerRegex: kubernetes\.\w+
- weight: 2
  condition: global.has-auth-service-role
  handlerRegex: api-key\.\w+
x-tagGroups:
- name: Pipelines / Builds
  tags:
  - Annotations
  - Builds
  - Execution Contexts
  - Images
  - Pipelines
  - Progress
  - Projects
  - Step-types
  - Triggers
  - Triggers Events
  - Triggers Types
- name: Kubernetes / Helm
  tags:
  - Environments V2
  - Helm Boards
  - Helm Charts
  - Helm Releases
  - Helm Sections
  - Kubernetes
- name: Swarm
  tags:
  - Compositions
  - Environments
- name: Integrations / Contexts
  tags:
  - Clusters
  - Contexts
  - Helm Cluster Configs
  - Helm Repos
  - Registries
  - Repos
- name: Account Management
  tags:
  - Abac
  - Accounts
  - Agents
  - Audit
  - Runtime Environments
  - Teams
  - Tokens
  - Views
- name: User Properties
  tags:
  - favorites
- name: On-Premise
  tags:
  - Features
  - Runtime Environments (Account)
  - Runtime Environments (Plan)
  - Runtime Environments (System)
  - Runtime Environments.
- name: Platform Analytics
  tags:


# --- truncated at 32 KB (140 KB total) ---
# Full source: https://artifacts.apis.io/codefresh/openapi/codefresh-contexts-api-openapi.yml