> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://useroot.docs.buildwithfern.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://useroot.docs.buildwithfern.com/_mcp/server.

# Approve single payin

POST https://api.useroot.com/api/payins/{payin_id}/approve

Approves a single payin for processing. The payin must be in **CREATED** status.

**Response body**

| Field  | Type   | Description                                                     |
| ------ | ------ | --------------------------------------------------------------- |
| `data` | Object | The payin object (`status` reflects the state at response time) |

**Success responses**

| Status Code | Description                                                                                                                                                                    |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **201**     | The payin was approved and processing continued; **`data.status`** reflects the outcome of this request.                                                                       |
| **202**     | The request was accepted and **`data`** includes the payin, but **`data.status`** may still change. Poll **`GET /api/payins/{id}`** until the payin reaches a terminal status. |

**Error and retry responses**

| Status Code | Error code             | Description                                                                                                                                                                                                  |
| ----------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **400**     | `INVALID_STATUS`       | The payin is not in **CREATED** status and cannot be approved.                                                                                                                                               |
| **401**     | `AUTHENTICATION_ERROR` | Authentication credentials are invalid or missing.                                                                                                                                                           |
| **403**     | `AUTHORIZATION_ERROR`  | You do not have permission to perform this action.                                                                                                                                                           |
| **404**     | `PAYIN_NOT_FOUND`      | Payin not found or does not belong to your entity.                                                                                                                                                           |
| **503**     | (see response body)    | **Transient error**—bank initiation could not be started for this request. **Retry** the same approve call after a short wait. The JSON body includes `error_code` and `message` for logging and automation. |

**Notes**

* Treat **202** like any accepted operation: use the returned id and **poll** until status stabilizes.
* **503** is for **retries**, not a final business outcome for the transfer.
* After approval, bank processing may continue after this response returns. There is no sync “initiation failed” **207** on this endpoint.

Reference: https://useroot.docs.buildwithfern.com/api-reference/payins-api/approve-payin

## Authentication

- `x-api-key` header (required) — RootPay API key sent in the x-api-key header. Keys are environment-scoped: live_* for production, test_* for sandbox.

## Request

### Path parameters

- `payin_id` (string, required)

## Response

### 201

Payin approved and initiated successfully

- `data` (object, optional, nullable) — Response model for payin operations.
  - `id` (string, required)
  - `payer_id` (string, required)
  - `amount_in_minor_units` (integer, required) — Amount in the currency's minor units (e.g. cents for USD).
  - `currency_code` (string, required)
  - `rail` (string, required)
  - `status` (enum, required) — Current status of the payin. One of: created, approved, initiated, debited, settled, failed, canceled.
    - Allowed values: `created`, `approved`, `initiated`, `debited`, `settled`, `failed`, `canceled`
  - `status_recorded_at` (datetime, required)
  - `payin_metadata` (map from string to any, required)
  - `created_at` (datetime, required)
  - `updated_at` (datetime, required)
  - `amount_in_cents` (integer, required, deprecated) — Deprecated. Use amount_in_minor_units instead. Still accepted and returned for backward compatibility.
  - `client_metadata` (map from string to any, optional)
  - `scheduled_date` (date, optional, nullable) — Caller-chosen send day in the schedule timezone (currently America/New_York), or null when immediate.
- `warning` (string, optional, nullable)

### 202

Accepted; response includes current state—poll GET for updates if status may change

## Examples

### Example 1

**Request**

```json
{}
```

**Response**

```json
{
  "data": {
    "id": "a3f1c9d2-4b7e-4f3a-9c2d-8e5b7f1a2c3d",
    "payer_id": "d9e8f7a6-b5c4-4d3e-9f8a-7b6c5d4e3f2a",
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "same_day_ach",
    "status": "approved",
    "status_recorded_at": "2024-01-15T09:30:00Z",
    "payin_metadata": {
      "invoice_id": "INV-20240115-001",
      "customer_reference": "CUST-789456"
    },
    "created_at": "2024-01-15T09:00:00Z",
    "updated_at": "2024-01-15T09:30:00Z",
    "amount_in_cents": 25000,
    "client_metadata": {
      "source_app": "web_portal",
      "user_id": "user_12345"
    },
    "scheduled_date": null
  },
  "warning": null
}
```

**SDK Code**

```python
import requests

url = "https://api.useroot.com/api/payins/payin_id/approve"

payload = {}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.useroot.com/api/payins/payin_id/approve';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/payins/payin_id/approve"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/payins/payin_id/approve")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.useroot.com/api/payins/payin_id/approve")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.useroot.com/api/payins/payin_id/approve', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/payins/payin_id/approve");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-api-key": "<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.useroot.com/api/payins/payin_id/approve")! 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()
```

### Example 2

**Request**

```json
{}
```

**Response**

```json
{
  "data": {
    "id": "a3f1c9d2-4b7e-4f3a-9c2d-8e5b7f1a2c3d",
    "payer_id": "d9e8f7a6-b5c4-4d3e-9f8a-7b6c5d4e3f2a",
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "same_day_ach",
    "status": "approved",
    "status_recorded_at": "2024-01-15T09:30:00Z",
    "payin_metadata": {
      "invoice_id": "INV-20240115-001",
      "customer_reference": "CUST-789456"
    },
    "created_at": "2024-01-15T09:00:00Z",
    "updated_at": "2024-01-15T09:30:00Z",
    "amount_in_cents": 25000,
    "client_metadata": {
      "source_app": "web_portal",
      "user_id": "user_12345"
    },
    "scheduled_date": null
  },
  "warning": null
}
```

**SDK Code**

```python
import requests

url = "https://api.useroot.com/api/payins/payin_id/approve"

payload = {}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.useroot.com/api/payins/payin_id/approve';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/payins/payin_id/approve"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/payins/payin_id/approve")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.useroot.com/api/payins/payin_id/approve")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.useroot.com/api/payins/payin_id/approve', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/payins/payin_id/approve");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-api-key": "<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.useroot.com/api/payins/payin_id/approve")! 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()
```