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

# Upload agent content

> Parses the supplied config, creates a new agent version from it, and returns the new
version number together with the agent's resulting validation status. Semantic validation
errors (e.g. a missing required export column) do **not** prevent the version from being
created - they are returned in `errors` so the caller can decide whether to fix them. Syntax
errors, however, are rejected outright and no version is written.

`content` must be a JSON object - the same shape returned by `GET {agentId}/content`'s
default `format=json` (not the plain-text NestedText produced by `format=yaml`).

`comments` is a mandatory commit message describing the change.

`expectedVersion` is an optional optimistic-concurrency guard: when set, the upload is rejected
with a conflict if the agent's current version does not match it.

Requires write access to the agent.



## OpenAPI

````yaml POST /api/v1/agent/{agentId}/content
openapi: 3.0.1
info:
  title: Sequentum Cloud API
  description: API endpoints for Sequentum Cloud
  version: v1
servers: []
security:
  - ApiKey: []
    Bearer: []
paths:
  /api/v1/agent/{agentId}/content:
    post:
      tags:
        - ApiAgent
      summary: Upload a new version of an agent's content
      description: >-
        Parses the supplied config, creates a new agent version from it, and
        returns the new

        version number together with the agent's resulting validation status.
        Semantic validation

        errors (e.g. a missing required export column) do **not** prevent the
        version from being

        created - they are returned in `errors` so the caller can decide whether
        to fix them. Syntax

        errors, however, are rejected outright and no version is written.


        `content` must be a JSON object - the same shape returned by `GET
        {agentId}/content`'s

        default `format=json` (not the plain-text NestedText produced by
        `format=yaml`).


        `comments` is a mandatory commit message describing the change.


        `expectedVersion` is an optional optimistic-concurrency guard: when set,
        the upload is rejected

        with a conflict if the agent's current version does not match it.


        Requires write access to the agent.
      parameters:
        - name: agentId
          in: path
          description: The ID of the agent
          required: true
          schema:
            type: integer
            format: int32
      requestBody:
        description: The new content, commit comments, and optional expected version
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UploadAgentContentRequest'
          text/json:
            schema:
              $ref: '#/components/schemas/UploadAgentContentRequest'
          application/*+json:
            schema:
              $ref: '#/components/schemas/UploadAgentContentRequest'
      responses:
        '200':
          description: The new version was created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadAgentContentResult'
        '400':
          description: If the request is invalid or the content has a syntax error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
        '401':
          description: If the API key is missing or invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: >-
            If the agent is not found, or the user doesn't have write access to
            it
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '409':
          description: If `expectedVersion` no longer matches the agent's current version
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictError'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
      x-codeSamples:
        - lang: curl
          label: cURL
          source: >-
            curl -X POST
            https://dashboard.sequentum.com/api/v1/agent/123/content \
              -H "Authorization: ApiKey $SEQUENTUM_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "content": {
                  "Agent": {
                    "Commands": [
                      { "Type": "URL", "Name": "URL", "Input": { "Static Value": "https://example.com" } }
                    ],
                    "Export": { "Export Name": "My Agent" }
                  }
                },
                "comments": "Point at the new start URL"
              }'
        - lang: node
          label: Node.js
          source: >-
            const res = await
            fetch("https://dashboard.sequentum.com/api/v1/agent/123/content", {
              method: "POST",
              headers: {
                "Authorization": `ApiKey ${process.env.SEQUENTUM_API_KEY}`,
                "Content-Type": "application/json",
              },
              body: JSON.stringify({
                // content must be the canonical config JSON object - the same shape returned by
                // GET {agentId}/content's default format=json (not the format=yaml NestedText string).
                content: {
                  Agent: {
                    Commands: [
                      { Type: "URL", Name: "URL", Input: { "Static Value": "https://example.com" } },
                    ],
                    Export: { "Export Name": "My Agent" },
                  },
                },
                comments: "Point at the new start URL",
                // Optional optimistic-concurrency guard: reject the upload with a 409 if the agent
                // has since moved past this version.
                // expectedVersion: 4,
              }),
            });


            const result = await res.json();

            console.log(`Created version ${result.newVersion}, status
            ${result.validationStatus}`);
        - lang: python
          label: Python
          source: >-
            import os

            import requests


            response = requests.post(
                "https://dashboard.sequentum.com/api/v1/agent/123/content",
                headers={
                    "Authorization": f"ApiKey {os.environ['SEQUENTUM_API_KEY']}",
                    "Content-Type": "application/json",
                },
                json={
                    # content must be the canonical config JSON object - the same shape returned by
                    # GET {agentId}/content's default format=json (not the format=yaml NestedText string).
                    "content": {
                        "Agent": {
                            "Commands": [
                                {"Type": "URL", "Name": "URL", "Input": {"Static Value": "https://example.com"}}
                            ],
                            "Export": {"Export Name": "My Agent"},
                        }
                    },
                    "comments": "Point at the new start URL",
                    # Optional optimistic-concurrency guard: reject the upload with a 409 if the agent
                    # has since moved past this version.
                    # "expectedVersion": 4,
                },
            )

            response.raise_for_status()

            result = response.json()

            print(f"Created version {result['newVersion']}, status
            {result['validationStatus']}")
components:
  schemas:
    UploadAgentContentRequest:
      required:
        - comments
      type: object
      properties:
        content:
          description: "The agent's full config as a JSON object - the same shape returned by the download endpoints'\r\ndefault `format=json` (not the plain-text NestedText produced by `format=yaml`). Must be a\r\nJSON object."
          example:
            Agent:
              Commands:
                - Type: URL
                  Name: URL
                  Input:
                    Static Value: https://example.com
              Export:
                Export Name: My Agent
        comments:
          minLength: 1
          type: string
          description: >-
            A mandatory commit message describing the change, stored alongside
            the new version.
          example: Point at the new start URL
        expectedVersion:
          type: integer
          description: "Optional optimistic-concurrency guard. When set, the upload is rejected with a conflict if the\r\nagent's current version does not match this value."
          format: int32
          nullable: true
      additionalProperties: false
      description: Request body for uploading a new version of an agent's content.
    UploadAgentContentResult:
      type: object
      properties:
        agentId:
          type: integer
          description: The ID of the agent this content belongs to.
          format: int32
        newVersion:
          type: integer
          description: The newly created version number.
          format: int32
        validationStatus:
          $ref: '#/components/schemas/ConfigValidationStatus'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ConfigValidationError'
          description: >-
            Semantic validation errors, if any. Non-empty only when
            `validationStatus` is `2` (`Invalid`) - these do not prevent the
            version from being created.
          nullable: true
      additionalProperties: false
      description: "Result of uploading a new version of an agent's content. Semantic validation errors do\r\nnot prevent the version from being created - they are returned alongside it so the caller can decide\r\nwhether to fix them."
    BadRequestError:
      type: object
      properties:
        statusCode:
          type: integer
          format: int32
        statusDescription:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
          readOnly: true
        severity:
          $ref: '#/components/schemas/ErrorSeverity'
        errorCode:
          type: string
          description: "Optional machine-readable error code. When present, clients should switch on this\r\nvalue rather than parsing Sequentum.Enterprise.Core.ControllerError.Message. Omitted from the response when null."
          nullable: true
      additionalProperties: false
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
      additionalProperties: {}
    ConflictError:
      type: object
      properties:
        statusCode:
          type: integer
          format: int32
        statusDescription:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
          readOnly: true
        severity:
          $ref: '#/components/schemas/ErrorSeverity'
        errorCode:
          type: string
          description: "Optional machine-readable error code. When present, clients should switch on this\r\nvalue rather than parsing Sequentum.Enterprise.Core.ControllerError.Message. Omitted from the response when null."
          nullable: true
      additionalProperties: false
    ConfigValidationStatus:
      enum:
        - 1
        - 2
        - 3
      type: integer
      description: "Semantic validation status of a config's most recently saved definition (e.g. whether every\r\nfixed export schema column is actually produced by a command). Serialized as its underlying\r\nint, not a string - see Sequentum.Enterprise.ControlCenter.Swagger.EnumDescriptionsSchemaFilter\r\nfor how these values get documented in the public OpenAPI spec. (`1` = `Unknown` - Validation status was not computed for this response (e.g. a historical config version, which does not retain its own stored status); `2` = `Invalid` - The config has one or more semantic validation errors (e.g. a required export column with no producing command); `3` = `Valid` - The config has no semantic validation errors)"
      format: int32
    ConfigValidationError:
      type: object
      properties:
        path:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
      additionalProperties: false
    ErrorSeverity:
      enum:
        - 0
        - 1
        - 2
        - 3
        - 4
      type: integer
      description: >-
        `0` = `Error`; `1` = `Unexpected`; `2` = `Fatal`; `3` = `Warning`; `4` =
        `Info`
      format: int32
  securitySchemes:
    ApiKey:
      type: apiKey
      description: >-
        API Key authorization header. Example: "Authorization: ApiKey
        {your-api-key}"
      name: Authorization
      in: header
    Bearer:
      type: http
      description: 'OAuth 2.0 Bearer token. Example: "Authorization: Bearer {access-token}"'
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.