> ## 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.

# Get agent content

> Returns the latest version of an agent's content. Edit it and upload it via
`POST {agentId}/content` to create a new version.

`format` controls the shape of the returned `content`:
- `json` (default) - the canonical config as a JSON object. This is the only format
  `POST {agentId}/content` accepts.
- `yaml` - the plain-text NestedText format used by the agent editor, returned as a string.

Secret values in the content (for example static input values, or FTP/Snowflake
passwords and API keys) are returned as encrypted ciphertext, not plaintext.

Requires read access to the agent.



## OpenAPI

````yaml GET /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:
    get:
      tags:
        - ApiAgent
      summary: Get an agent's content
      description: >-
        Returns the latest version of an agent's content. Edit it and upload it
        via

        `POST {agentId}/content` to create a new version.


        `format` controls the shape of the returned `content`:

        - `json` (default) - the canonical config as a JSON object. This is the
        only format
          `POST {agentId}/content` accepts.
        - `yaml` - the plain-text NestedText format used by the agent editor,
        returned as a string.


        Secret values in the content (for example static input values, or
        FTP/Snowflake

        passwords and API keys) are returned as encrypted ciphertext, not
        plaintext.


        Requires read access to the agent.
      parameters:
        - name: agentId
          in: path
          description: The ID of the agent
          required: true
          schema:
            type: integer
            format: int32
        - name: format
          in: query
          description: Either `json` (default) or `yaml`
          schema:
            $ref: '#/components/schemas/AgentContentFormat'
      responses:
        '200':
          description: The agent's content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentContentModel'
        '400':
          description: If `format` is not `json` or `yaml`
          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 read access to
            it
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '422':
          description: >-
            If `format=yaml` and this agent's content cannot be represented as
            yaml; retry with `format=json`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityError'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
      x-codeSamples:
        - lang: curl
          label: cURL
          source: >-
            curl https://dashboard.sequentum.com/api/v1/agent/123/content \
              -H "Authorization: ApiKey $SEQUENTUM_API_KEY"

            # Add ?format=yaml to get the plain-text NestedText format instead
            (content becomes a string):

            # curl
            https://dashboard.sequentum.com/api/v1/agent/123/content?format=yaml
            \

            #   -H "Authorization: ApiKey $SEQUENTUM_API_KEY"
        - lang: node
          label: Node.js
          source: >-
            const res = await
            fetch("https://dashboard.sequentum.com/api/v1/agent/123/content", {
              headers: {
                "Authorization": `ApiKey ${process.env.SEQUENTUM_API_KEY}`,
              },
            });


            const agentContent = await res.json();

            console.log(agentContent.content); // a JSON object, e.g. { Agent: {
            Commands: [...] } }


            // Add ?format=yaml to the URL to get the plain-text NestedText
            format instead

            // (content becomes a string).
        - lang: python
          label: Python
          source: >-
            import os

            import requests


            response = requests.get(
                "https://dashboard.sequentum.com/api/v1/agent/123/content",
                headers={"Authorization": f"ApiKey {os.environ['SEQUENTUM_API_KEY']}"},
            )

            response.raise_for_status()

            agent_content = response.json()

            print(agent_content["content"])  # a JSON object, e.g. {"Agent":
            {"Commands": [...]}}


            # Add ?format=yaml to the URL to get the plain-text NestedText
            format instead

            # (content becomes a string).
components:
  schemas:
    AgentContentFormat:
      enum:
        - json
        - yaml
      type: string
      description: "Which shape an agent's content is exchanged in on the agent-content download endpoints\r\n(`GET {agentId}/content`, `GET {agentId}/version/{versionNumber}/content`). The\r\nupload endpoint (`POST {agentId}/content`) only ever accepts Sequentum.Enterprise.ControlCenter.AgentContentFormat.Json. (`0` = `Json`; `1` = `Yaml`)"
    AgentContentModel:
      type: object
      properties:
        agentId:
          type: integer
          description: The ID of the agent this content belongs to.
          format: int32
        version:
          type: integer
          description: >-
            The version number of this content, matching the requested version,
            or the agent's latest version if none was requested.
          format: int32
        validationStatus:
          $ref: '#/components/schemas/ConfigValidationStatus'
        content:
          description: "The agent's content. A JSON object holding the canonical config when `format=json` (the\r\ndefault), or a plain-text NestedText string when `format=yaml` - see the `format` query\r\nparameter on this endpoint."
          nullable: true
      additionalProperties: false
      description: "An agent's content, returned by the agent-content download endpoints - either the latest\r\nversion or a specific historical one."
    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: {}
    UnprocessableEntityError:
      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
    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.