> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainloop.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Record a deployment

> Creates or updates a deployment record linking an artifact to an environment. If a record for the same environment and deployment name already exists, it will be updated.



## OpenAPI

````yaml https://api.app.chainloop.dev/openapi.yaml post /v1/deployments
openapi: 3.0.1
info:
  contact:
    email: support@chainloop.dev
    name: Chainloop Support
    url: https://chainloop.dev
  termsOfService: https://chainloop.dev/terms
  title: Chainloop Platform API
  version: '1.0'
servers:
  - url: https://api.app.chainloop.dev/
security:
  - bearerToken: []
tags:
  - description: AI-powered agent operations
    name: AgentsService
  - name: ArtifactService
  - name: AssessmentService
  - description: Service for polling the status of asynchronous operations
    name: AsyncOperationsService
  - name: AttestationsService
  - name: PolicyService
  - name: ComplianceService
  - name: ComponentService
  - name: EnvironmentsService
  - name: EvidenceService
  - name: FindingService
  - name: LogicalEnvironmentsService
  - name: ProductsService
  - name: ProjectsService
  - name: UserService
externalDocs:
  description: Chainloop Official Documentation
  url: https://docs.chainloop.dev
paths:
  /v1/deployments:
    post:
      tags:
        - EnvironmentsService
      summary: Record a deployment
      description: >-
        Creates or updates a deployment record linking an artifact to an
        environment. If a record for the same environment and deployment name
        already exists, it will be updated.
      operationId: EnvironmentsService_RecordDeployment
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/v1EnvironmentsServiceRecordDeploymentRequest
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/v1EnvironmentsServiceRecordDeploymentResponse
          description: A successful response.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1BadRequestResponse'
          description: Bad Request - The request was invalid or cannot be served.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1UnauthorizedResponse'
          description: Unauthorized - Authentication is required.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1PermissionDeniedResponse'
          description: Forbidden - You do not have permission to access this resource.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1InternalServerErrorResponse'
          description: Internal Server Error - An unexpected error occurred on the server.
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
          description: An unexpected error response.
components:
  schemas:
    v1EnvironmentsServiceRecordDeploymentRequest:
      properties:
        environment_name:
          title: Name of the environment to deploy to (DNS-1123 compliant, required)
          type: string
        artifact_digest:
          title: Digest of the artifact being deployed (required)
          type: string
        kind:
          $ref: >-
            #/components/schemas/EnvironmentsServiceRecordDeploymentRequestArtifactKind
        artifact_name:
          title: Optional name of the artifact
          type: string
        artifact_version:
          title: Optional version of the artifact
          type: string
        status:
          $ref: '#/components/schemas/DeploymentRecordDeploymentStatus'
        deployment_name:
          title: >-
            DeploymentName is the stable slot identifier within an environment
            (required, DNS-1123 compliant)
          type: string
        logical_environment_name:
          title: Logical environment name (DNS-1123 compliant, required)
          type: string
      title: >-
        EnvironmentsServiceRecordDeploymentRequest is the request message for
        recording a deployment
      type: object
    v1EnvironmentsServiceRecordDeploymentResponse:
      example:
        deployment_record:
          artifact:
            kind: kind
            name: name
            digest: digest
            version: version
          logical_environment_id: logical_environment_id
          environment_id: environment_id
          updated_at: '2000-01-23T04:56:07.000Z'
          deployment_name: deployment_name
          created_at: '2000-01-23T04:56:07.000Z'
          id: id
          logical_environment_name: logical_environment_name
          last_seen_at: '2000-01-23T04:56:07.000Z'
          artifact_id: artifact_id
          status: DEPLOYMENT_STATUS_UNSPECIFIED
          environment_name: environment_name
      properties:
        deployment_record:
          $ref: '#/components/schemas/v1DeploymentRecord'
      title: >-
        EnvironmentsServiceRecordDeploymentResponse is the response message for
        recording a deployment
      type: object
    v1BadRequestResponse:
      description: Response for bad request
      example:
        code: 0
        details:
          - details
          - details
        message: message
      properties:
        code:
          default: 3
          description: >-
            The error code indicating the type of error. It's fixed to 3, which
            is the code for INVALID_ARGUMENT.
          format: int32
          type: integer
        message:
          description: A human-readable message providing more details about the error.
          type: string
        details:
          description: Additional details about the error.
          items:
            type: string
          type: array
      required:
        - code
        - message
      title: BadRequestResponse
      type: object
    v1UnauthorizedResponse:
      description: Response for unauthorized access
      example:
        code: 6
        details:
          - details
          - details
        message: message
      properties:
        code:
          default: 16
          description: >-
            The error code indicating the type of error. It's fixed to 16, which
            is the code for UNAUTHENTICATED.
          format: int32
          type: integer
        message:
          description: A human-readable message providing more details about the error.
          type: string
        details:
          description: Additional details about the error.
          items:
            type: string
          type: array
      required:
        - code
        - message
      title: UnauthorizedResponse
      type: object
    v1PermissionDeniedResponse:
      description: Response for permission denied
      example:
        code: 1
        details:
          - details
          - details
        message: message
      properties:
        code:
          default: 7
          description: >-
            The error code indicating the type of error. It's fixed to 7, which
            is the code for PERMISSION_DENIED.
          format: int32
          type: integer
        message:
          description: A human-readable message providing more details about the error.
          type: string
        details:
          description: Additional details about the error.
          items:
            type: string
          type: array
      required:
        - code
        - message
      title: PermissionDeniedResponse
      type: object
    v1InternalServerErrorResponse:
      description: Response for internal server error
      example:
        code: 5
        details:
          - details
          - details
        message: message
      properties:
        code:
          default: 13
          description: >-
            The error code indicating the type of error. It's fixed to 13, which
            is the code for INTERNAL_ERROR.
          format: int32
          type: integer
        message:
          description: A human-readable message providing more details about the error.
          type: string
        details:
          description: Additional details about the error.
          items:
            type: string
          type: array
      required:
        - code
        - message
      title: InternalServerErrorResponse
      type: object
    rpcStatus:
      example:
        code: 5
        details:
          - '@type': '@type'
          - '@type': '@type'
        message: message
      properties:
        code:
          format: int32
          type: integer
        message:
          type: string
        details:
          items:
            $ref: '#/components/schemas/protobufAny'
          type: array
      type: object
    EnvironmentsServiceRecordDeploymentRequestArtifactKind:
      default: ARTIFACT_KIND_UNSPECIFIED
      enum:
        - ARTIFACT_KIND_UNSPECIFIED
        - CONTAINER_IMAGE
        - HELM_CHART
      type: string
    DeploymentRecordDeploymentStatus:
      default: DEPLOYMENT_STATUS_UNSPECIFIED
      description: |2-
         - DEPLOYED: DEPLOYED indicates the artifact is currently running in the environment slot.
         - DECOMMISSIONED: DECOMMISSIONED indicates the artifact has been intentionally removed from the environment slot.
         - SUPERSEDED: SUPERSEDED indicates the artifact was replaced by a different artifact in the same environment slot.
      enum:
        - DEPLOYMENT_STATUS_UNSPECIFIED
        - DEPLOYED
        - DECOMMISSIONED
        - SUPERSEDED
      type: string
    v1DeploymentRecord:
      example:
        artifact:
          kind: kind
          name: name
          digest: digest
          version: version
        logical_environment_id: logical_environment_id
        environment_id: environment_id
        updated_at: '2000-01-23T04:56:07.000Z'
        deployment_name: deployment_name
        created_at: '2000-01-23T04:56:07.000Z'
        id: id
        logical_environment_name: logical_environment_name
        last_seen_at: '2000-01-23T04:56:07.000Z'
        artifact_id: artifact_id
        status: DEPLOYMENT_STATUS_UNSPECIFIED
        environment_name: environment_name
      properties:
        id:
          title: ID is the unique identifier of the deployment record
          type: string
        environment_id:
          title: EnvironmentID is the environment this deployment targets
          type: string
        status:
          $ref: '#/components/schemas/DeploymentRecordDeploymentStatus'
        last_seen_at:
          format: date-time
          title: >-
            LastSeenAt is the timestamp of the last time this deployment was
            seen
          type: string
        created_at:
          format: date-time
          title: CreatedAt is the time when the deployment record was created
          type: string
        updated_at:
          format: date-time
          title: UpdatedAt is the time when the deployment record was last updated
          type: string
        environment_name:
          title: EnvironmentName is the name of the environment
          type: string
        artifact_id:
          title: ArtifactID is the ID of the associated artifact
          type: string
        artifact:
          $ref: '#/components/schemas/v1ComponentArtifact'
        deployment_name:
          title: DeploymentName is the stable slot identifier within an environment
          type: string
        logical_environment_id:
          title: >-
            LogicalEnvironmentId is the optional logical environment associated
            with this deployment
          type: string
        logical_environment_name:
          title: >-
            LogicalEnvironmentName is the name of the logical environment
            associated with this deployment
          type: string
      title: |-
        DeploymentStatus defines the status of a deployment
        DeploymentRecord represents a deployment record entity
      type: object
    protobufAny:
      additionalProperties:
        type: object
      example:
        '@type': '@type'
      properties:
        '@type':
          type: string
      type: object
    v1ComponentArtifact:
      description: An artifact associated with a component
      example:
        kind: kind
        name: name
        digest: digest
        version: version
      properties:
        kind:
          description: Type of artifact (e.g., CONTAINER_IMAGE, HELM_CHART)
          title: Kind is the type of artifact (e.g., CONTAINER_IMAGE, HELM_CHART)
          type: string
        name:
          description: Name of the artifact (e.g., container image name)
          title: Name is the name of the artifact (e.g., container image name)
          type: string
        version:
          description: Version of the artifact (e.g., container image tag)
          title: Version is the version of the artifact (e.g., container image tag)
          type: string
        digest:
          description: Content digest of the artifact
          title: Digest is the content digest of the artifact
          type: string
      title: ComponentArtifact
      type: object
  securitySchemes:
    bearerToken:
      description: Bearer token for authentication
      type: http
      scheme: bearer
      bearerFormat: JWT

````