> 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

# Send bill for approval

POST https://api-sandbox.payabli.com/api/Bill/approval/{idBill}
Content-Type: application/json

Send a bill to a user or list of users to approve.

Reference: https://docs.payabli.com/developers/api-reference/bill/send-a-bill-to-approval

## Authentication

- `Authorization` header (bearer token, required)
- `requestToken` header (required) — Long-lived API token sent in the `requestToken` header. See [API token authentication](/developers/api-tokens).

## Servers

- `https://api-sandbox.payabli.com/api` (Sandbox, default)
- `https://api.payabli.com/api` (Production)

## Request

### Path parameters

- `idBill` (integer, required) — Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization.

### Query parameters

- `autocreateUser` (boolean, optional, default: false) — Automatically create the target user for approval if they don't exist.

### Headers

- `idempotencyKey` (string, optional) — _Optional but recommended_ A unique ID that you can include to prevent duplicating objects or transactions in the case that a request is sent more than once. This key isn't generated in Payabli, you must generate it yourself. This key persists for 2 minutes. After 2 minutes, you can reuse the key if needed.

### Body (application/json)

- `list of string`

## Response

### 200

Success

- `responseText` (string, required) — Response text for operation: 'Success' or 'Declined'.
- `responseCode` (integer, optional) — Code for the response. Learn more in [API Response Codes](/developers/api-reference/api-responses).
- `pageIdentifier` (string, optional, nullable) — Auxiliary validation used internally by payment pages and components.
- `roomId` (long, optional) — Field not in use on this endpoint. It always returns `0`.
- `isSuccess` (boolean, optional) — Boolean indicating whether the operation was successful. A `true` value indicates success. A `false` value indicates failure.
- `responseData` (string or integer, optional) — If `isSuccess` = true, this contains the bill identifier. If `isSuccess` = false, this contains the reason for the error.

## Examples

**Request**

```json
[
  "approver@example.com"
]
```

**Response**

```json
{
  "responseText": "Success",
  "responseCode": 1,
  "pageIdentifier": null,
  "roomId": 0,
  "isSuccess": true,
  "responseData": 6101
}
```

**SDK Code**

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

async function main() {
    const client = new PayabliClient({
        clientId: "YOUR_CLIENT_ID",
        clientSecret: "YOUR_CLIENT_SECRET",
    });
    await client.bill.sendToApprovalBill(285, {
        idempotencyKey: "6B29FC40-CA47-1067-B31D-00DD010662DA",
        body: [
            "approver@example.com",
        ],
    });
}
main();

```

```python
from payabli import payabli

client = payabli(
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)

client.bill.send_to_approval_bill(
    id_bill=285,
    idempotency_key="6B29FC40-CA47-1067-B31D-00DD010662DA",
    request=[
        "approver@example.com"
    ],
)

```

```java
package com.example.usage;

import io.github.payabli.api.PayabliApiClient;
import io.github.payabli.api.resources.bill.requests.SendToApprovalBillRequest;
import java.util.Arrays;

public class Example {
    public static void main(String[] args) {
        PayabliApiClient client = PayabliApiClient.withCredentials("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET")
            .build()
        ;

        client.bill().sendToApprovalBill(
            285,
            SendToApprovalBillRequest
                .builder()
                .body(
                    Arrays.asList("approver@example.com")
                )
                .idempotencyKey("6B29FC40-CA47-1067-B31D-00DD010662DA")
                .build()
        );
    }
}
```

```ruby
require "payabli"

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

client.bill.send_to_approval_bill(
  id_bill: 285,
  idempotency_key: "6B29FC40-CA47-1067-B31D-00DD010662DA",
  body: ["approver@example.com"]
)

```

```csharp
using PayabliApi;
using System.Threading.Tasks;
using System.Collections.Generic;

public partial class Examples
{
    public async Task Example() {
        var client = new PayabliApiClient(
            clientId: "YOUR_CLIENT_ID",
            clientSecret: "YOUR_CLIENT_SECRET"
        );

        await client.Bill.SendToApprovalBillAsync(
            idBill: 285,
            request: new SendToApprovalBillRequest {
                IdempotencyKey = "6B29FC40-CA47-1067-B31D-00DD010662DA",
                Body = new List<string>(){
                    "approver@example.com",
                }

            }
        );
    }

}

```

```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.WithClientCredentials(
            "YOUR_CLIENT_ID",
            "YOUR_CLIENT_SECRET",
        ),
    )
    request := &payabli.SendToApprovalBillRequest{
        IdempotencyKey: payabli.String(
            "6B29FC40-CA47-1067-B31D-00DD010662DA",
        ),
        Body: []string{
            "approver@example.com",
        },
    }
    client.Bill.SendToApprovalBill(
        context.TODO(),
        285,
        request,
    )
}

```

```php
<?php

namespace Example;

use Payabli\PayabliClient;
use Payabli\Bill\Requests\SendToApprovalBillRequest;

$client = new PayabliClient(
    clientId: 'YOUR_CLIENT_ID',
    clientSecret: 'YOUR_CLIENT_SECRET',
);
$client->bill->sendToApprovalBill(
    285,
    new SendToApprovalBillRequest([
        'idempotencyKey' => '6B29FC40-CA47-1067-B31D-00DD010662DA',
        'body' => [
            'approver@example.com',
        ],
    ]),
);

```

```swift
import Foundation

let headers = [
  "idempotencyKey": "6B29FC40-CA47-1067-B31D-00DD010662DA",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["approver@example.com"] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Bill/approval/285")! 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()
```