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

# Set a domain's scan login

> Creates or replaces the domain's scan login. Use `basic` for HTTP basic auth, on every plan, or `form` to sign in through a login form, which needs the `true_user_auth` entitlement (Pro and Enterprise). A `form` login needs a `login_url` on the domain's site and a `logged_in_selector`. `password` is required the first time; omit it later to keep the stored one. Returns `403` for a viewer or for `form` without the entitlement, `400` for an off-site login URL or a missing logged-in check, and `503` when scan logins aren't available on this deployment.



## OpenAPI

````yaml /api-reference/openapi.json put /v1/domains/{slug}/scan-auth
openapi: 3.1.0
info:
  title: ility API
  version: 1.0.0
  description: Read accessibility results and start scans in your ility workspace.
servers:
  - url: https://app.ilitylabs.com
security:
  - apiKey: []
tags:
  - name: Workspaces
  - name: Surfaces
  - name: Domains
  - name: Scans
  - name: Issues
paths:
  /v1/domains/{slug}/scan-auth:
    put:
      tags:
        - Domains
      summary: Set a domain's scan login
      description: >-
        Creates or replaces the domain's scan login. Use `basic` for HTTP basic
        auth, on every plan, or `form` to sign in through a login form, which
        needs the `true_user_auth` entitlement (Pro and Enterprise). A `form`
        login needs a `login_url` on the domain's site and a
        `logged_in_selector`. `password` is required the first time; omit it
        later to keep the stored one. Returns `403` for a viewer or for `form`
        without the entitlement, `400` for an off-site login URL or a missing
        logged-in check, and `503` when scan logins aren't available on this
        deployment.
      parameters:
        - schema:
            type: string
            minLength: 1
          required: true
          name: slug
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PutScanAuthBody'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScanAuth'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            Viewer role, or a scripted login without the trueUserAuth
            entitlement
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: This deployment cannot store credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    PutScanAuthBody:
      type: object
      properties:
        method:
          type: string
          enum:
            - basic
            - form
        username:
          type: string
          minLength: 1
          maxLength: 320
        password:
          type: string
          maxLength: 1024
          description: Required the first time. Omit to keep the stored password.
        login_url:
          type:
            - string
            - 'null'
          maxLength: 2048
        username_selector:
          type:
            - string
            - 'null'
          maxLength: 500
        password_selector:
          type:
            - string
            - 'null'
          maxLength: 500
        submit_selector:
          type:
            - string
            - 'null'
          maxLength: 500
        logged_in_selector:
          type:
            - string
            - 'null'
          maxLength: 500
      required:
        - method
        - username
    ScanAuth:
      type: object
      properties:
        available:
          type: boolean
          description: >-
            False when this deployment cannot store credentials
            (SCAN_CREDENTIAL_KEY unset).
        configured:
          type: boolean
        method:
          anyOf:
            - type: string
              enum:
                - basic
                - form
            - type: 'null'
        username:
          type:
            - string
            - 'null'
        has_password:
          type: boolean
        login_url:
          type:
            - string
            - 'null'
        username_selector:
          type:
            - string
            - 'null'
        password_selector:
          type:
            - string
            - 'null'
        submit_selector:
          type:
            - string
            - 'null'
        logged_in_selector:
          type:
            - string
            - 'null'
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - available
        - configured
        - method
        - username
        - has_password
        - login_url
        - username_selector
        - password_selector
        - submit_selector
        - logged_in_selector
        - updated_at
    ErrorResponse:
      type: object
      properties:
        detail:
          type: string
        reason:
          type: string
      required:
        - detail
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        An ility API key, such as `ilk_1a2b3c4d_…`. Workspace owners create keys
        under Settings → API keys.

````

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