> This is Payabli documentation. For a complete page index, fetch https://docs.payabli.com/llms.txt — append .md to any page URL for lightweight markdown. For section-level indexes, query parameters, and other AI-optimized access methods, see https://docs.payabli.com/ai-agents.md

# Authenticate user

POST https://api-sandbox.payabli.com/api/User/auth/{provider}
Content-Type: application/json

This endpoint requires an application API token.

Reference: https://docs.payabli.com/developers/api-reference/user/authenticate-user

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: payabliApi-oas
  version: 1.0.0
paths:
  /User/auth/{provider}:
    post:
      operationId: auth-user
      summary: Authenticate User
      description: This endpoint requires an application API token.
      tags:
        - subpackage_user
      parameters:
        - name: provider
          in: path
          description: Auth provider. Pass `null` to use the built-in provider.
          required: true
          schema:
            type: string
        - name: requestToken
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliApiResponseMfaBasic'
        '400':
          description: Bad request / invalid data.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '401':
          description: Unauthorized request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '503':
          description: Database connection error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserAuthRequest'
servers:
  - url: https://api-sandbox.payabli.com/api
    description: Sandbox
  - url: https://api.payabli.com/api
    description: Production
components:
  schemas:
    Email:
      type: string
      format: email
      description: Email address.
      title: Email
    UserAuthRequest:
      type: object
      properties:
        email:
          $ref: '#/components/schemas/Email'
        entry:
          type: string
          description: >-
            Identifier for entry point originating the request (used by
            front-end apps)
        entryType:
          type: integer
          description: >-
            Type of entry identifier: 0 - partner, 2 - paypoint. This is used by
            front-end apps, required if an Entry is indicated.
        psw:
          type: string
        userId:
          type: integer
          format: int64
        userTokenId:
          type: string
      title: UserAuthRequest
    IsSuccess:
      type: boolean
      description: |
        Boolean indicating whether the operation was successful. A `true` value
        indicates success. A `false` value indicates failure.
      title: IsSuccess
    Mfa:
      type: boolean
      description: When `true`, multi-factor authentication (MFA) is enabled.
      title: Mfa
    MfaValidationCode:
      type: string
      description: |
        The validation code for multi-factor authentication, typically a hash or
        similar encrypted format.
      title: MfaValidationCode
    ResponseText:
      type: string
      description: |
        Response text for operation: 'Success' or 'Declined'.
      title: ResponseText
    PayabliApiResponseMfaBasic:
      type: object
      properties:
        isSuccess:
          $ref: '#/components/schemas/IsSuccess'
        mfa:
          $ref: '#/components/schemas/Mfa'
        mfaMode:
          type: string
          description: The mode of multi-factor authentication used.
        mfaValidationCode:
          $ref: '#/components/schemas/MfaValidationCode'
        responseData:
          type: string
          description: Data returned by the response, masked for security.
        responseText:
          $ref: '#/components/schemas/ResponseText'
      required:
        - responseText
      title: PayabliApiResponseMfaBasic
    PayabliErrorBodyResponseData:
      type: object
      properties:
        explanation:
          type: string
          description: Human-readable explanation of what happened.
        todoAction:
          type: string
          description: Suggested resolution.
      description: Object with detailed error context.
      title: PayabliErrorBodyResponseData
    PayabliErrorBody:
      type: object
      properties:
        isSuccess:
          type: boolean
          description: Always `false` for error responses.
        responseCode:
          type: integer
          description: |
            Code for the response. Learn more in
            [API Response Codes](/developers/api-reference/api-responses).
        responseText:
          type: string
          description: Error text describing what went wrong.
        responseData:
          $ref: '#/components/schemas/PayabliErrorBodyResponseData'
          description: Object with detailed error context.
      required:
        - isSuccess
        - responseText
      description: |
        Shape returned by every Payabli API error response. The `responseData`
        object carries human-readable error context.
      title: PayabliErrorBody
  securitySchemes:
    APIKeyAuth:
      type: apiKey
      in: header
      name: requestToken

```

## Examples



**Request**

```json
{}
```

**Response**

```json
{
  "responseText": "Success",
  "isSuccess": true,
  "mfa": false,
  "mfaMode": "email",
  "mfaValidationCode": "50-2E-4A-16-93-0E-41-41-07-EE-22-B6-00-99-00-99",
  "responseData": "g**.com"
}
```

**SDK Code**

```typescript
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.user.authUser("provider", {});
}
main();

```

```python
from payabli import payabli

client = payabli(
    api_key="YOUR_API_KEY_HERE",
)

client.user.auth_user(
    provider="provider",
)

```

```java
package com.example.usage;

import io.github.payabli.api.PayabliPayabliApiOasClient;
import io.github.payabli.api.resources.user.requests.UserAuthRequest;

public class Example {
    public static void main(String[] args) {
        PayabliPayabliApiOasClient client = PayabliPayabliApiOasClient
            .builder()
            .apiKey("YOUR_API_KEY_HERE")
            .build();

        client.user().authUser(
            "provider",
            UserAuthRequest
                .builder()
                .build()
        );
    }
}
```

```ruby
require "payabli"

client = Payabli::Client.new(api_key: "YOUR_API_KEY_HERE")

client.user.auth_user(provider: "provider")

```

```csharp
using PayabliPayabliApiOas;
using System.Threading.Tasks;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayabliPayabliApiOasClient(
            apiKey: "YOUR_API_KEY_HERE"
        );

        await client.User.AuthUserAsync(
            "provider",
            new UserAuthRequest()
        );
    }

}

```

```go
package example

import (
    context "context"

    payabli "github.com/payabli/sdk-go"
    client "github.com/payabli/sdk-go/client"
    option "github.com/payabli/sdk-go/option"
)

func do() {
    client := client.NewClient(
        option.WithApiKey(
            "YOUR_API_KEY_HERE",
        ),
    )
    request := &payabli.UserAuthRequest{}
    client.User.AuthUser(
        context.TODO(),
        "provider",
        request,
    )
}

```

```php
<?php

namespace Example;

use Payabli\PayabliClient;
use Payabli\User\Requests\UserAuthRequest;

$client = new PayabliClient(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->user->authUser(
    'provider',
    new UserAuthRequest([]),
);

```

```swift
import Foundation

let headers = [
  "requestToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/User/auth/provider")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```