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

# Create deployment

> Create a new deployment for an app or worker



## OpenAPI

````yaml https://api.getcargo.io/openapi.json post /hosting/deployments
openapi: 3.1.0
info:
  title: Cargo API
  version: 1.0.0
  description: Cargo Platform API v1
servers:
  - url: https://api.getcargo.io/v1
    description: Cargo API
security:
  - bearerAuth: []
paths:
  /hosting/deployments:
    post:
      tags:
        - Hosting - Deployments
      summary: Create deployment
      description: Create a new deployment for an app or worker
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  properties:
                    kind:
                      type: string
                      const: app
                      title: Kind
                      description: Discriminator for an app-backed deployment.
                    appUuid:
                      type: string
                      format: uuid
                      pattern: >-
                        ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$
                      title: App UUID
                      description: Identifier of the app to deploy.
                    files:
                      type: array
                      items:
                        type: object
                        properties:
                          path:
                            type: string
                            minLength: 1
                          content:
                            type: string
                        required:
                          - path
                          - content
                      title: Source files
                      description: Inline source files for the deployment.
                  required:
                    - kind
                    - appUuid
                    - files
                  additionalProperties: false
                - type: object
                  properties:
                    kind:
                      type: string
                      const: worker
                      title: Kind
                      description: Discriminator for a worker-backed deployment.
                    workerUuid:
                      type: string
                      format: uuid
                      pattern: >-
                        ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$
                      title: Worker UUID
                      description: Identifier of the worker to deploy.
                    files:
                      type: array
                      items:
                        type: object
                        properties:
                          path:
                            type: string
                            minLength: 1
                          content:
                            type: string
                        required:
                          - path
                          - content
                      title: Source files
                      description: Inline source files for the deployment.
                  required:
                    - kind
                    - workerUuid
                    - files
                  additionalProperties: false
              title: Request body
              description: Request body schema.
              type: object
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  deployment:
                    oneOf:
                      - type: object
                        properties:
                          uuid:
                            type: string
                            format: uuid
                            pattern: >-
                              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                          workspaceUuid:
                            type: string
                            format: uuid
                            pattern: >-
                              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                          sourceS3Path:
                            type: string
                          bundleS3Path:
                            anyOf:
                              - type: string
                              - type: 'null'
                          status:
                            type: string
                            enum:
                              - pending
                              - building
                              - success
                              - error
                              - cancelled
                          buildLogS3Filename:
                            anyOf:
                              - type: string
                              - type: 'null'
                          errorMessage:
                            anyOf:
                              - type: string
                              - type: 'null'
                          url:
                            type: string
                          userUuid:
                            type: string
                            format: uuid
                            pattern: >-
                              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                          promotedAt:
                            anyOf:
                              - type: string
                              - type: 'null'
                          promotedByUserUuid:
                            anyOf:
                              - type: string
                                format: uuid
                                pattern: >-
                                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                              - type: 'null'
                          finishedAt:
                            anyOf:
                              - type: string
                              - type: 'null'
                          temporalWorkflowId:
                            type: string
                            format: uuid
                            pattern: >-
                              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                          createdAt:
                            type: string
                          updatedAt:
                            type: string
                          kind:
                            type: string
                            const: app
                          appUuid:
                            type: string
                            format: uuid
                            pattern: >-
                              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                          meta:
                            type: object
                            properties: {}
                            additionalProperties: false
                        required:
                          - uuid
                          - workspaceUuid
                          - sourceS3Path
                          - bundleS3Path
                          - status
                          - buildLogS3Filename
                          - errorMessage
                          - url
                          - userUuid
                          - promotedAt
                          - promotedByUserUuid
                          - finishedAt
                          - temporalWorkflowId
                          - createdAt
                          - updatedAt
                          - kind
                          - appUuid
                          - meta
                        additionalProperties: false
                      - type: object
                        properties:
                          uuid:
                            type: string
                            format: uuid
                            pattern: >-
                              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                          workspaceUuid:
                            type: string
                            format: uuid
                            pattern: >-
                              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                          sourceS3Path:
                            type: string
                          bundleS3Path:
                            anyOf:
                              - type: string
                              - type: 'null'
                          status:
                            type: string
                            enum:
                              - pending
                              - building
                              - success
                              - error
                              - cancelled
                          buildLogS3Filename:
                            anyOf:
                              - type: string
                              - type: 'null'
                          errorMessage:
                            anyOf:
                              - type: string
                              - type: 'null'
                          url:
                            type: string
                          userUuid:
                            type: string
                            format: uuid
                            pattern: >-
                              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                          promotedAt:
                            anyOf:
                              - type: string
                              - type: 'null'
                          promotedByUserUuid:
                            anyOf:
                              - type: string
                                format: uuid
                                pattern: >-
                                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                              - type: 'null'
                          finishedAt:
                            anyOf:
                              - type: string
                              - type: 'null'
                          temporalWorkflowId:
                            type: string
                            format: uuid
                            pattern: >-
                              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                          createdAt:
                            type: string
                          updatedAt:
                            type: string
                          kind:
                            type: string
                            const: worker
                          workerUuid:
                            type: string
                            format: uuid
                            pattern: >-
                              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                          meta:
                            type: object
                            properties:
                              bundleSha256:
                                type: string
                              outboundAllowlist:
                                type: array
                                items:
                                  type: string
                              kind:
                                type: string
                                const: custom-integration
                            required:
                              - bundleSha256
                              - outboundAllowlist
                            additionalProperties: false
                        required:
                          - uuid
                          - workspaceUuid
                          - sourceS3Path
                          - bundleS3Path
                          - status
                          - buildLogS3Filename
                          - errorMessage
                          - url
                          - userUuid
                          - promotedAt
                          - promotedByUserUuid
                          - finishedAt
                          - temporalWorkflowId
                          - createdAt
                          - updatedAt
                          - kind
                          - workerUuid
                          - meta
                        additionalProperties: false
                    title: Deployment
                    description: Created deployment details.
                    type: object
                required:
                  - deployment
                additionalProperties: false
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '500':
          description: Internal server error
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````