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

# Test ad-hoc credentials

> Verify a credentials dict without saving anything (the UI's test-before-save flow). Admin only. Always returns HTTP 200 with a TestResult — the `success`/`error` fields carry the outcome, including timeouts.



## OpenAPI

````yaml /openapi.json post /connections/test
openapi: 3.1.0
info:
  title: GetDialed Flows API
  version: 0.1.0
servers:
  - url: https://api.getdialed.ai/flows
    description: Production
  - url: http://localhost:8000
    description: Local development
security: []
paths:
  /connections/test:
    post:
      tags:
        - connections
      summary: Test ad-hoc credentials
      description: >-
        Verify a credentials dict without saving anything (the UI's
        test-before-save flow). Admin only. Always returns HTTP 200 with a
        TestResult — the `success`/`error` fields carry the outcome, including
        timeouts.
      operationId: test_unsaved_credentials_connections_test_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConnectionTestRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TestResult'
        '401':
          description: Missing or invalid authentication
          content:
            application/json:
              example:
                detail: Authentication required
        '403':
          description: Caller is authenticated but not an admin
          content:
            application/json:
              example:
                detail: Admin role required
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Rate limit exceeded — retry after the Retry-After header
          headers:
            Retry-After:
              description: Seconds to wait before retrying
              schema:
                type: integer
          content:
            application/json:
              example:
                detail: 'Rate limit exceeded: 100 per 1 minute'
      security:
        - APIKeyHeader: []
        - HTTPBearer: []
components:
  schemas:
    ConnectionTestRequest:
      properties:
        platform_id:
          type: string
          title: Platform Id
        service_id:
          type: string
          title: Service Id
        auth_method:
          type: string
          enum:
            - basic_auth
            - oauth2
            - client_credentials
            - jwt
            - api_key
            - soap_wss
          title: Auth Method
        credentials:
          additionalProperties: true
          type: object
          title: Credentials
      type: object
      required:
        - platform_id
        - service_id
        - auth_method
        - credentials
      title: ConnectionTestRequest
      description: |-
        Ad-hoc credentials test request body (D-06).

        Used by POST /connections/test (no saved connection required). The
        UI's "test before save" flow posts this body to verify credentials
        before calling POST /connections to persist them.

        Differs from ConnectionCreate: no `name`, no `credentials_ref`,
        no `status`. `credentials` is REQUIRED (not optional) — the whole
        point is to test a specific credentials dict.
      example:
        auth_method: basic_auth
        credentials:
          password: REPLACE_ME
          username: api_user@example
        platform_id: five9
        service_id: five9__configuration
    TestResult:
      properties:
        success:
          type: boolean
          title: Success
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        details:
          type: string
          title: Details
        latency_ms:
          type: integer
          title: Latency Ms
        tested_at:
          type: string
          format: date-time
          title: Tested At
      type: object
      required:
        - success
        - error
        - details
        - latency_ms
        - tested_at
      title: TestResult
      description: >-
        Result of a connection test (D-08, 5 fields locked).


        Returned by both POST /connections/{conn_id}/test and POST
        /connections/test

        with HTTP 200 for ALL handler outcomes including timeouts (D-03). The UI

        always parses this exact shape regardless of failure mode.


        `error` is one of 7 codes (D-09) when success=False, or None when
        success=True:
          - AUTH_FAILED, NETWORK, TIMEOUT, RATE_LIMITED,
            PERMISSION_DENIED, INVALID_CREDENTIALS_SHAPE, UNKNOWN

        `error` is typed as `str | None` (not Literal[...]) per PATTERNS.md

        anti-pattern note: keeps schema evolution decoupled from handler logic.


        `latency_ms` is HANDLER-measured (start of network round-trip to end of

        response parsing); excludes API/serialization overhead.


        `tested_at` is set by the HANDLER at the start of the attempt, not by

        the router. (A4 binding in 38-RESEARCH.md.)
      example:
        details: Authenticated successfully; 3 lists visible
        latency_ms: 412
        success: true
        tested_at: '2026-07-09T18:00:00Z'
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
    HTTPBearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````