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

# Validate inputs against a template

> Validates the provided attributes against the template's field definitions without running a calculation. Useful for pre-flight validation before calling the calculate endpoint.



## OpenAPI

````yaml api/openapi.json POST /v1/templates/{code}/validate
openapi: 3.1.0
info:
  title: Connections Hub API
  version: 1.0.0
  description: >-
    Run HSS Connections Hub calculators programmatically: create projects,
    create and solve sheets from any calculator template, run batches, and
    export reports to PDF.


    All endpoints require API key authentication.
servers:
  - url: https://api.calcs.com
security:
  - bearerAuth: []
tags:
  - name: Projects
    description: >-
      Create and manage calculation projects. Each user can have multiple
      projects to organize their calculations.
  - name: Sheets
    description: >-
      Manage individual calculation sheets — read one back, update its inputs,
      solve or re-solve it, and delete single sheets or clean up many at once.
  - name: Templates
    description: >-
      Run calculations using any enabled template. Supports all calculator types
      without requiring endpoint-specific code.
paths:
  /v1/templates/{code}/validate:
    post:
      tags:
        - Templates
      summary: Validate inputs against a template
      description: >-
        Validates the provided attributes against the template's field
        definitions without running a calculation. Useful for pre-flight
        validation before calling the calculate endpoint.
      operationId: template-validate
      parameters:
        - name: Authorization
          in: header
          required: true
          example: Bearer YOUR_KEY_HERE
          schema:
            type: string
          description: >-
            The `Authorization` header is used to authenticate with the API
            using your API key. Value is of the format `Bearer YOUR_KEY_HERE`.
        - name: code
          in: path
          required: true
          schema:
            type: string
          description: >-
            Template code, as returned by `GET /v1/templates` (e.g.
            `steelConnectionHssBeamToHssMomentAISC360-22`).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - attributes
              properties:
                preset:
                  type: string
                  description: Optional preset code to apply defaults before validation
                attributes:
                  type: object
                  description: Widget reference IDs and their values to validate
                  additionalProperties: true
      responses:
        '200':
          description: Validation passed
          content:
            application/json:
              schema:
                type: object
                properties:
                  valid:
                    type: boolean
                    enum:
                      - true
                  warnings:
                    type: array
                    items:
                      type: object
                    description: Non-fatal warnings (e.g., deprecated fields)
        '400':
          description: Invalid request body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '404':
          description: The template does not exist, or is not accessible with this API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                not_found:
                  summary: >-
                    Template does not exist, or is not accessible with this API
                    key
                  value:
                    error:
                      code: NOT_FOUND
                      message: Template not found.
        '422':
          description: Validation failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  valid:
                    type: boolean
                    enum:
                      - false
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                          description: Field that failed validation
                        message:
                          type: string
                          description: Validation error message
                  warnings:
                    type: array
                    items:
                      type: object
                    description: Non-fatal warnings
        '500':
          description: Validation failed due to server error
      security:
        - api_key: []
components:
  schemas:
    ValidationError:
      type: object
      description: Validation error response for invalid API inputs
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - VALIDATION_ERROR
              description: Error code for validation failures
            message:
              type: string
              description: Human-readable error summary
              example: Input validation failed
            details:
              type: array
              description: Array of specific validation errors
              items:
                type: object
                properties:
                  field:
                    type: string
                    description: Path to the invalid field (e.g., 'L_X', 'supports.0.2')
                  message:
                    type: string
                    description: Description of what's wrong with the field
                required:
                  - field
                  - message
          required:
            - code
            - message
      required:
        - error
      example:
        error:
          code: VALIDATION_ERROR
          message: Input validation failed
          details:
            - field: L_X
              message: Expected number, received string
            - field: supports
              message: At least 2 supports are required
    ErrorResponse:
      type: object
      description: >-
        Standard error envelope for handler errors. `code` is a stable
        machine-readable error code (e.g. NOT_FOUND, UPSTREAM_ERROR); `message`
        is human-readable and may change.
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable error code.
            message:
              type: string
              description: Human-readable error message.
          required:
            - code
            - message
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send your API key as a bearer token: `Authorization: Bearer
        YOUR_API_KEY`. Every endpoint requires one.
    api_key:
      type: http
      scheme: bearer

````

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