> For a complete index of Agora Finance documentation, fetch https://docs.agora.finance/llms.txt

# Simulate a Wire

POST https://api.sandbox.agora.finance/v0/sandbox/wires
Content-Type: application/json

Sandbox only. Simulates an incoming USD wire into one of your mint-fiat routes. The route's token is sent to its destination wallet on testnet, and the mint appears in your transactions. No real money moves.

Reference: https://docs.agora.finance/api/sandbox/endpoints/sandbox-tools/wires

## Authentication

- `Authorization` header (bearer token, required) — Session JWT from `POST /v0/auth/token`, sent as `Authorization: Bearer <sessionJwt>`. See [Authentication](/api/authentication) for more details.

## Request

### Body (application/json)

This endpoint expects an object.

- `amount` (string, required) — USD the simulated wire sends, as a decimal string. The route pays the same amount of its token.
- `routeId` (string, required) — The mint-fiat route the wire is sent to.
- `sourceAccountId` (string, required) — A bank account registered to your organization (`POST /v0/accounts`, kind `bank`). The wire comes from it.

## Response

### 202

OK

- `amount` (string, required) — USD sent, as a decimal string.
- `id` (string, required) — The simulated wire's id.
- `routeId` (string, required)
- `sandbox` (any, required) — Always true: this endpoint exists only in the sandbox.
- `status` (enum, required) — The wire is recorded and the route's token sent shortly after this response. Poll `GET /v0/transactions` to see the mint.
  - Allowed values: `queued`

## Errors

### 400 Bad Request Error

One or more request parameters are invalid.

- `code` (enum, required)
  - Allowed values: `parameter_invalid`
- `docs_url` (string, required)
- `message` (string, required)
- `context` (ErrorResponse400ParameterInvalidContext, optional)

### 401 Unauthorized Error

Authentication is required.

- `code` (enum, required)
  - Allowed values: `unauthorized`
- `docs_url` (string, required)
- `message` (string, required)
- `context` (ErrorResponse401UnauthorizedContext, optional)

### 403 Forbidden Error

- `account_not_eligible`: The account is not eligible for this request. - `account_not_provisioned`: The account is not provisioned for this product. - `account_verification_pending`: Account verification for this product is pending. - `forbidden`: Access to this resource is forbidden.

- `code` (enum, required)
  - Allowed values: `account_not_eligible`, `account_not_provisioned`, `account_verification_pending`, `forbidden`
- `docs_url` (string, required)
- `message` (string, required)

### 404 Not Found Error

- `account_not_found`: Account not found. - `not_found`: Resource not found. - `route_not_found`: Route not found.

- `code` (enum, required)
  - Allowed values: `account_not_found`, `not_found`, `route_not_found`
- `docs_url` (string, required)
- `message` (string, required)

### 429 Too Many Requests Error

Too many requests.

- `code` (enum, required)
  - Allowed values: `rate_limit_exceeded`
- `docs_url` (string, required)
- `message` (string, required)

### 500 Internal Server Error

An unexpected error occurred.

- `code` (enum, required)
  - Allowed values: `internal_error`
- `docs_url` (string, required)
- `message` (string, required)

## Types

### ErrorResponse400ParameterInvalidContext

- `issues` (list of ErrorResponse400ParameterInvalidContextIssuesItems, required)

### ErrorResponse401UnauthorizedContext

- `reason` (enum, required)
  - Allowed values: `invalid_token`, `key_not_provisioned`, `missing_claim`, `missing_header`, `token_expired`, `token_paused`, `token_revoked`, `unknown_tenant`

### ErrorResponse400ParameterInvalidContextIssuesItems

- `field` (string, required)
- `message` (string, required)

## Examples

**Request**

```json
{
  "amount": "100.00",
  "routeId": "2b7c4e1a-9f3d-4c8b-a6e2-5d1f0b3c7a94",
  "sourceAccountId": "8c2d4f6a-1b3e-4a5c-9d7f-0e2a4b6c8d1f"
}
```

**Response**

```json
{
  "amount": "100.00",
  "id": "5e9a1c3b-7d2f-4b6e-8a0c-3f5d7b9e1a2c",
  "routeId": "2b7c4e1a-9f3d-4c8b-a6e2-5d1f0b3c7a94",
  "sandbox": true,
  "status": "queued"
}
```

**SDK Code**

```python
import requests

url = "https://api.sandbox.agora.finance/v0/sandbox/wires"

payload = {
    "amount": "100.00",
    "routeId": "2b7c4e1a-9f3d-4c8b-a6e2-5d1f0b3c7a94",
    "sourceAccountId": "8c2d4f6a-1b3e-4a5c-9d7f-0e2a4b6c8d1f"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.sandbox.agora.finance/v0/sandbox/wires';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"amount":"100.00","routeId":"2b7c4e1a-9f3d-4c8b-a6e2-5d1f0b3c7a94","sourceAccountId":"8c2d4f6a-1b3e-4a5c-9d7f-0e2a4b6c8d1f"}'
};

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.sandbox.agora.finance/v0/sandbox/wires"

	payload := strings.NewReader("{\n  \"amount\": \"100.00\",\n  \"routeId\": \"2b7c4e1a-9f3d-4c8b-a6e2-5d1f0b3c7a94\",\n  \"sourceAccountId\": \"8c2d4f6a-1b3e-4a5c-9d7f-0e2a4b6c8d1f\"\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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.sandbox.agora.finance/v0/sandbox/wires")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"amount\": \"100.00\",\n  \"routeId\": \"2b7c4e1a-9f3d-4c8b-a6e2-5d1f0b3c7a94\",\n  \"sourceAccountId\": \"8c2d4f6a-1b3e-4a5c-9d7f-0e2a4b6c8d1f\"\n}"

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.sandbox.agora.finance/v0/sandbox/wires")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"amount\": \"100.00\",\n  \"routeId\": \"2b7c4e1a-9f3d-4c8b-a6e2-5d1f0b3c7a94\",\n  \"sourceAccountId\": \"8c2d4f6a-1b3e-4a5c-9d7f-0e2a4b6c8d1f\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.sandbox.agora.finance/v0/sandbox/wires', [
  'body' => '{
  "amount": "100.00",
  "routeId": "2b7c4e1a-9f3d-4c8b-a6e2-5d1f0b3c7a94",
  "sourceAccountId": "8c2d4f6a-1b3e-4a5c-9d7f-0e2a4b6c8d1f"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.sandbox.agora.finance/v0/sandbox/wires");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"amount\": \"100.00\",\n  \"routeId\": \"2b7c4e1a-9f3d-4c8b-a6e2-5d1f0b3c7a94\",\n  \"sourceAccountId\": \"8c2d4f6a-1b3e-4a5c-9d7f-0e2a4b6c8d1f\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "amount": "100.00",
  "routeId": "2b7c4e1a-9f3d-4c8b-a6e2-5d1f0b3c7a94",
  "sourceAccountId": "8c2d4f6a-1b3e-4a5c-9d7f-0e2a4b6c8d1f"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.sandbox.agora.finance/v0/sandbox/wires")! 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()
```