---
updatedAt: 2026-05-27T09:42:20.000Z
agentTools:
  projectIndex: https://docs.truelayer.com/llms.txt
---

# Generate a direct bank authentication link

Direct bank authentication allows you to generate a link directly to the bank. You can direct your user to this link where they can authorise access to their bank account.

Anyone can test direct bank authentication in our sandbox environment. To use it in production, we must first approve your consent screens. [Learn more about consent screen requirements here](https://docs.truelayer.com/docs/ais-collecting-user-consent).


# OpenAPI definition

````json
{
  "openapi": "3.0.3",
  "info": {
    "version": "1.0.0",
    "title": "Authentication Server",
    "description": "The authentication server\n"
  },
  "servers": [
    {
      "url": "https://auth.truelayer-sandbox.com",
      "description": "Sandbox server"
    },
    {
      "url": "https://auth.truelayer.com",
      "description": "Production server"
    }
  ],
  "paths": {
    "/v1/authuri": {
      "post": {
        "tags": [
          "Auth link"
        ],
        "summary": "Generate a direct bank authentication link",
        "operationId": "GenerateDirectBankAuthLink",
        "description": "Direct bank authentication allows you to generate a link directly to the bank. You can direct your user to this link where they can authorise access to their bank account.\n\nAnyone can test direct bank authentication in our sandbox environment. To use it in production, we must first approve your consent screens. [Learn more about consent screen requirements here](https://docs.truelayer.com/docs/ais-collecting-user-consent).\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DirectBankAuthLinkRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response returns the direct auth link in the `result` field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthUriResponse"
                },
                "examples": {
                  "reauthUriExample": {
                    "$ref": "#/components/examples/DirectBankAuth200Response"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        },
        "security": []
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Machine-readable error category",
            "enum": [
              "access_denied",
              "invalid_request",
              "unauthorized",
              "invalid_grant",
              "unauthorized_client",
              "internal_server_error",
              "not_found"
            ]
          },
          "error_description": {
            "type": "string",
            "description": "Human-readable explanation of the error"
          },
          "error_details": {
            "type": "object",
            "description": "Arbitrary key value pairs to provide more context for certain errors",
            "properties": {
              "reason": {
                "type": "string",
                "description": "Additional human-readable explanation as to the cause of the error"
              }
            }
          }
        }
      },
      "DirectBankAuthLinkRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "response_type",
          "client_id",
          "redirect_uri",
          "scope",
          "consent_id",
          "provider_id"
        ],
        "properties": {
          "response_type": {
            "type": "string",
            "description": "Must be `\"code\"`",
            "enum": [
              "code"
            ]
          },
          "client_id": {
            "type": "string",
            "description": "Your client ID"
          },
          "redirect_uri": {
            "type": "string",
            "description": "A valid redirect URI for your TrueLayer client ID (set in Console)"
          },
          "scope": {
            "type": "string",
            "description": "Space separated list of scopes representing the data you're asking the end user to share. Possible values:\n- `info`\n- `accounts`\n- `balance`\n- `transactions`\n- `standing_orders`\n- `direct_debits`\n- `offline_access`\n"
          },
          "state": {
            "type": "string",
            "description": "An opaque value used by the client to maintain state between the request and callback"
          },
          "consent_id": {
            "type": "string",
            "description": "Identifier to indicate the client has captured the user’s consent themselves. Any alphanumeric string allowed. Should be unique to track that the user has given consent."
          },
          "user": {
            "type": "object",
            "description": "You must provide the `name` and one of `email` or `phone`.",
            "properties": {
              "id": {
                "type": "string",
                "description": "A unique ID for the user",
                "example": "d0e122db-2264-4bbe-97a5-869c95a0aa9e"
              },
              "name": {
                "type": "string",
                "description": "The full name of the user",
                "example": "Alan Turing"
              },
              "email": {
                "type": "string",
                "format": "email",
                "description": "Email address of the user",
                "example": "alan.turing@bletchleypark.org.uk"
              },
              "phone": {
                "type": "string",
                "description": "Phone number of the user",
                "example": "+44777777777"
              }
            }
          },
          "data_use_description": {
            "type": "string",
            "description": "The exact copy shown to the user explaining what their data will be used for."
          },
          "provider_id": {
            "type": "string",
            "description": "The ID of the provider to direct the user to, so they can connect their account."
          },
          "code_challenge": {
            "type": "string",
            "description": "PKCE code challenge"
          },
          "code_challenge_method": {
            "type": "string",
            "description": "Must be `\"S256\"` if `code_challenge` is supplied",
            "enum": [
              "S256"
            ]
          },
          "response_mode": {
            "type": "string",
            "description": "Must be `\"form_post\"` if provided",
            "enum": [
              "form_post"
            ]
          },
          "auth_inputs": {
            "type": "array",
            "description": "Specify any required additional user input here. Our Providers API specifies which providers require these extra inputs (steps) and lists possible values where available.\n\nThis field requires specifying the input and the value. The key name should be the step `field.id` sourced from the Providers API and the value should be the user's selection. For example:\n```\n\"auth_inputs\": {\n  \"branch-name\": \"stet-credit-agricole-alpes-provence\"\n}\n```\n",
            "items": {
              "type": "object",
              "example": {
                "branch-name": "stet-credit-agricole-alpes-provence"
              }
            }
          },
          "tracking_id": {
            "type": "string",
            "description": "Allows you to query how far the user got in the authentication flow using Auth Journey Analytics."
          }
        }
      },
      "AuthUriResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "result",
          "success"
        ],
        "properties": {
          "result": {
            "type": "string",
            "format": "uri",
            "description": "Authentication link. Direct the end user here to (re)authenticate them."
          },
          "success": {
            "type": "boolean"
          }
        }
      }
    },
    "examples": {
      "InternalServerError500Response": {
        "summary": "Internal server error",
        "value": {
          "error_description": "Sorry, we are experiencing technical difficulties. Please try again later.",
          "error": "internal_server_error",
          "error_details": {}
        }
      },
      "DirectBankAuth200Response": {
        "summary": "Direct bank auth link for Monzo",
        "value": {
          "result": "https://verify.monzo.com/open-banking/authorize?client_id=oauth2client_abc123&request=ey...&state=auth-abc123nonce=WZIU7nl3cLimgW-OMVbKmI2fecWkYjNYjmmPnSVN&scope=openid&response_type=code%20id_token&redirect_uri=https%3A%2F%2Fauth.truelayer.com%2Foauth%2Fhybrid%2Fcallback",
          "success": true
        }
      },
      "Unauthorized401Response": {
        "summary": "Unauthorized request",
        "value": {
          "error_description": "Unauthorized.",
          "error": "unauthorized",
          "error_details": {
            "reason": "Invalid token"
          }
        }
      },
      "InvalidRefreshToken401Response": {
        "summary": "Invalid refresh token",
        "value": {
          "error_description": "Invalid request",
          "error": "invalid_request",
          "error_details": {
            "reason": "Invalid refresh_token"
          }
        }
      },
      "UnauthorizedClient401Response": {
        "summary": "Unauthorized client",
        "value": {
          "error_description": "The client credentials you have entered are incorrect. Please check and try again.",
          "error": "unauthorized_client",
          "error_details": {}
        }
      }
    },
    "responses": {
      "401": {
        "description": "Unauthorized request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "401Example": {
                "$ref": "#/components/examples/Unauthorized401Response"
              },
              "401InvalidRefreshTokenExample": {
                "$ref": "#/components/examples/InvalidRefreshToken401Response"
              },
              "401UnauthorizedClientExample": {
                "$ref": "#/components/examples/UnauthorizedClient401Response"
              }
            }
          }
        }
      },
      "500": {
        "description": "Internal server error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "500Example": {
                "$ref": "#/components/examples/InternalServerError500Response"
              }
            }
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": false,
    "samples-languages": [
      "shell",
      "java",
      "csharp",
      "php"
    ]
  }
}
````