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

> ## Agent Instructions
> AI agents that need Anchor credentials should start with https://docs.anchorbrowser.io/quickstart/agent-access. This flow lets agents obtain an API key programmatically without creating a dashboard account. Read that page before attempting authentication or API access.

# Resolve Dynamic Auth Flow Step

> Advances the flow by answering the current step. The body depends on the
last presentation's `type` — do not mix the two shapes:

- **`decision`**: send only `choice` (a `step_id` from `options`).
  Do not send `option_index` or `values`.
- **`form`**: send `option_index` (index into `options`) and `values`
  (field name → string). Do not send `choice`.

Do not call `/resolve` for `detection_failed`, `authenticated`, or `failed`.
For retryable `detection_failed`, a timeout, or a 409 (another transition
still in flight), poll `GET .../state/{session_id}` until a
`decision`/`form`/`authenticated` view appears, then continue. If
`detection_failed` is not retryable, open `live_view_url` to finish signing in.




## OpenAPI

````yaml /openapi.yaml post /v1/identities/dynamic/resolve/{session_id}
openapi: 3.1.0
info:
  title: AnchorBrowser API
  version: 1.0.0
  description: APIs to manage all browser-related actions and configuration.
servers:
  - url: https://api.anchorbrowser.io
    description: API server
security: []
paths:
  /v1/identities/dynamic/resolve/{session_id}:
    post:
      tags:
        - Identities
      summary: Resolve Dynamic Auth Flow Step
      description: >
        Advances the flow by answering the current step. The body depends on the

        last presentation's `type` — do not mix the two shapes:


        - **`decision`**: send only `choice` (a `step_id` from `options`).
          Do not send `option_index` or `values`.
        - **`form`**: send `option_index` (index into `options`) and `values`
          (field name → string). Do not send `choice`.

        Do not call `/resolve` for `detection_failed`, `authenticated`, or
        `failed`.

        For retryable `detection_failed`, a timeout, or a 409 (another
        transition

        still in flight), poll `GET .../state/{session_id}` until a

        `decision`/`form`/`authenticated` view appears, then continue. If

        `detection_failed` is not retryable, open `live_view_url` to finish
        signing in.
      parameters:
        - name: session_id
          in: path
          required: true
          description: Session whose auth flow to advance.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthFlowV2ResolveRequest'
            examples:
              form:
                summary: Submit values for a form option
                description: |
                  Use the same shape for every form option. For an email MFA
                  option, send `gmail_tokens` in `values` instead of username
                  and password.
                value:
                  option_index: 0
                  values:
                    username: user@example.com
                    password: secret
              decision:
                summary: Choose one option from a decision response
                value:
                  choice: <step_id from response.options>
      responses:
        '200':
          description: Next presentation of the auth flow
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthFlowV2View'
              examples:
                decision:
                  summary: Next step asks you to choose a sign-in method
                  value:
                    type: decision
                    session_id: abc-123
                    host: example.com
                    current_step_label: Sign in
                    step_id: root/login
                    options:
                      - step_id: root/login/password
                        label: Email and password
                        automatable: true
                      - step_id: root/login/google
                        label: Continue with Google
                        automatable: false
                      - step_id: root/login/sso
                        label: Continue with SSO
                        automatable: false
                form:
                  summary: Next step asks you to submit form values
                  value:
                    type: form
                    session_id: abc-123
                    host: example.com
                    current_step_label: Sign in
                    step_id: root/credentials
                    options:
                      - type: credentials
                        automatable: true
                        inputs:
                          - name: username
                            type: text
                            label: Email
                          - name: password
                            type: password
                            label: Password
                      - type: gmail_one_click_integration
                        automatable: true
                        inputs:
                          - name: gmail_tokens
                            type: text
                            label: Gmail token
        '400':
          description: Invalid choice, option index, or missing field
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Session, flow, or step not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Auth flow transition already in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Failed to resolve auth flow
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - api_key_header: []
components:
  schemas:
    AuthFlowV2ResolveRequest:
      oneOf:
        - $ref: '#/components/schemas/AuthFlowV2FormResolve'
        - $ref: '#/components/schemas/AuthFlowV2DecisionResolve'
      description: >
        Body depends on the last `view.type`. Use the `decision` shape or the
        `form`

        shape — not both.
    AuthFlowV2View:
      description: >
        Presentation returned by start/resolve. GET `/state` nests the same
        object as

        `view` when there is something to show. Discriminated on `type`. Call
        `/resolve`

        only for `decision` or `form`.
      oneOf:
        - $ref: '#/components/schemas/AuthFlowV2DecisionView'
        - $ref: '#/components/schemas/AuthFlowV2FormView'
        - $ref: '#/components/schemas/AuthFlowV2DetectionFailedView'
        - $ref: '#/components/schemas/AuthFlowV2AuthenticatedView'
        - $ref: '#/components/schemas/AuthFlowV2FailedView'
      discriminator:
        propertyName: type
        mapping:
          decision:
            $ref: '#/components/schemas/AuthFlowV2DecisionView'
          form:
            $ref: '#/components/schemas/AuthFlowV2FormView'
          detection_failed:
            $ref: '#/components/schemas/AuthFlowV2DetectionFailedView'
          authenticated:
            $ref: '#/components/schemas/AuthFlowV2AuthenticatedView'
          failed:
            $ref: '#/components/schemas/AuthFlowV2FailedView'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
    AuthFlowV2FormResolve:
      title: form
      type: object
      required:
        - option_index
        - values
      description: Send this when the last presentation was a form step.
      properties:
        option_index:
          type: integer
          minimum: 0
          description: Index into that form's `options` list.
          example: 0
        values:
          type: object
          additionalProperties:
            type: string
          description: >-
            Map of input name → value for the selected option
            (`options[option_index].inputs` lists the names).
          example:
            username: user@example.com
            password: secret
    AuthFlowV2DecisionResolve:
      title: decision
      type: object
      required:
        - choice
      description: Send this when the last presentation was a decision step.
      properties:
        choice:
          type: string
          description: One of `options[].step_id` from the decision view.
          example: root/login/google
    AuthFlowV2DecisionView:
      title: decision
      allOf:
        - $ref: '#/components/schemas/AuthFlowV2ViewBase'
        - type: object
          required:
            - type
            - options
          properties:
            type:
              type: string
              enum:
                - decision
            options:
              type: array
              description: |
                Each item is `{ step_id, label, automatable }`.
                POST `/resolve` with `{ "choice": "<step_id>" }`.
              items:
                $ref: '#/components/schemas/AuthFlowV2DecisionOption'
    AuthFlowV2FormView:
      title: form
      allOf:
        - $ref: '#/components/schemas/AuthFlowV2ViewBase'
        - type: object
          required:
            - type
            - options
          properties:
            type:
              type: string
              enum:
                - form
            options:
              type: array
              description: |
                Each item includes `type` and `automatable`.
                POST `/resolve` with `{ "option_index": n, "values": { ... } }`.
              items:
                $ref: '#/components/schemas/AuthFlowV2FormOption'
            credentials_rejected:
              type: boolean
              description: >-
                The last submission was rejected (e.g. wrong password) and the
                same form is re-presented.
            credentials_passed:
              type: boolean
              description: The previous step just cleared. Transient.
    AuthFlowV2DetectionFailedView:
      title: detection_failed
      allOf:
        - $ref: '#/components/schemas/AuthFlowV2ViewBase'
        - type: object
          required:
            - type
            - node_status
            - retryable
            - message
          properties:
            type:
              type: string
              enum:
                - detection_failed
            node_status:
              type: string
              enum:
                - detected
                - failed
                - explored
              description: How far the current step has been analyzed.
            last_error:
              type: string
              description: The most recent navigation error, if any.
            retryable:
              type: boolean
              description: >-
                True means keep polling `/state`; false means stop and use
                `live_view_url`.
            message:
              type: string
              description: >
                Why detection stopped. Open `live_view_url` to finish signing in
                in the browser.

                Do not resolve. If `retryable` is true, you may also poll GET
                `/state`.
    AuthFlowV2AuthenticatedView:
      title: authenticated
      allOf:
        - $ref: '#/components/schemas/AuthFlowV2ViewBase'
        - type: object
          required:
            - type
          properties:
            type:
              type: string
              enum:
                - authenticated
            message:
              type: string
              description: Human-readable status. POST `/finalize` to persist the identity.
    AuthFlowV2FailedView:
      title: failed
      allOf:
        - $ref: '#/components/schemas/AuthFlowV2ViewBase'
        - type: object
          required:
            - type
            - error
            - retryable
          properties:
            type:
              type: string
              enum:
                - failed
            error:
              type: string
              description: What went wrong.
            retryable:
              type: boolean
              description: True means keep polling `/state`; false means stop.
    AuthFlowV2ViewBase:
      type: object
      required:
        - session_id
        - host
        - current_step_label
        - step_id
        - cdp_url
        - live_view_url
      properties:
        session_id:
          type: string
        host:
          type: string
          description: Hostname the flow was started for.
        current_step_label:
          type: string
          description: Human-readable label of the current login step.
        step_id:
          type: string
          description: Identifier of the current login step.
        cdp_url:
          type: string
          description: CDP websocket URL of the session driving the login.
        live_view_url:
          type: string
          description: URL to watch or take over the session in a browser.
        discovery_error:
          type: string
          description: >-
            Set when automatic step detection hit an error. A partial flow may
            still be presented.
    AuthFlowV2DecisionOption:
      type: object
      required:
        - step_id
        - label
        - automatable
      description: |
        One option on a `decision` step. The option's `step_id` is the value to
        send as `choice` on `/resolve`; the decision view's `step_id` identifies
        the step that is asking you to choose.
      properties:
        step_id:
          type: string
          description: Opaque identifier for this option; pass it back as `choice`.
        label:
          type: string
          description: Human-readable name of the login path (e.g. "Continue with Google").
        automatable:
          type: boolean
          description: >-
            True if this path is known to be replayable unattended, without a
            human.
    AuthFlowV2FormOption:
      type: object
      required:
        - type
        - automatable
      description: >
        One way to complete a `form` step. Pick it with `option_index` on
        `/resolve`.

        `automatable` is true when this option can be replayed unattended
        (typically

        `credentials`, `totp_secret`, `gmail_one_click_integration`). Captcha,
        passkey,

        consent, and magic_link are typically false.


        `gmail_one_click_integration`: open `extra_data.create_integration_url`
        in a

        browser once; it returns a value to send as `values.gmail_tokens` on
        `/resolve`.

        The token is bound to the Gmail account, not to this flow — reuse it on
        any

        later email MFA form for that account, across applications, without

        authorizing again.
      properties:
        type:
          type: string
          enum:
            - credentials
            - mfa_totp
            - mfa_sms
            - mfa_email
            - sso
            - captcha
            - consent
            - magic_link
            - passkey
            - generic
            - totp_secret
            - gmail_one_click_integration
        automatable:
          type: boolean
          description: True if this option can be replayed unattended without a human.
        inputs:
          type: array
          items:
            type: object
            required:
              - name
              - type
            properties:
              name:
                type: string
              type:
                type: string
              label:
                type: string
              placeholder:
                type: string
              value:
                type: string
        extra_data:
          type: object
          additionalProperties: true
          description: Type-specific extras. Present only when the option has any.
          properties:
            create_integration_url:
              type: string
              format: uri
              description: >-
                On `gmail_one_click_integration`. Browser URL to connect Gmail;
                see the option description for the token it returns.
            number:
              type: string
              description: >-
                On `consent`. Device confirmation number from the live page,
                when shown.
        message:
          type: string
        provider:
          type: string
        phoneHint:
          type: string
  securitySchemes:
    api_key_header:
      type: apiKey
      in: header
      name: anchor-api-key
      description: API key passed in the header

````