POST Create subaccount
{{baseUrl}}/:api_key/subaccounts
QUERY PARAMS

api_key
BODY json

{
  "name": "",
  "secret": "",
  "use_primary_account_balance": false
}
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:api_key/subaccounts");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n  \"name\": \"\",\n  \"secret\": \"\",\n  \"use_primary_account_balance\": false\n}");

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/post "{{baseUrl}}/:api_key/subaccounts" {:content-type :json
                                                                 :form-params {:name ""
                                                                               :secret ""
                                                                               :use_primary_account_balance false}})
require "http/client"

url = "{{baseUrl}}/:api_key/subaccounts"
headers = HTTP::Headers{
  "content-type" => "application/json"
}
reqBody = "{\n  \"name\": \"\",\n  \"secret\": \"\",\n  \"use_primary_account_balance\": false\n}"

response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("{{baseUrl}}/:api_key/subaccounts"),
    Content = new StringContent("{\n  \"name\": \"\",\n  \"secret\": \"\",\n  \"use_primary_account_balance\": false\n}")
    {
        Headers =
        {
            ContentType = new MediaTypeHeaderValue("application/json")
        }
    }
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:api_key/subaccounts");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"\",\n  \"secret\": \"\",\n  \"use_primary_account_balance\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main

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

func main() {

	url := "{{baseUrl}}/:api_key/subaccounts"

	payload := strings.NewReader("{\n  \"name\": \"\",\n  \"secret\": \"\",\n  \"use_primary_account_balance\": false\n}")

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

	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))

}
POST /baseUrl/:api_key/subaccounts HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 72

{
  "name": "",
  "secret": "",
  "use_primary_account_balance": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:api_key/subaccounts")
  .setHeader("content-type", "application/json")
  .setBody("{\n  \"name\": \"\",\n  \"secret\": \"\",\n  \"use_primary_account_balance\": false\n}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/:api_key/subaccounts"))
    .header("content-type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\n  \"name\": \"\",\n  \"secret\": \"\",\n  \"use_primary_account_balance\": false\n}"))
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"name\": \"\",\n  \"secret\": \"\",\n  \"use_primary_account_balance\": false\n}");
Request request = new Request.Builder()
  .url("{{baseUrl}}/:api_key/subaccounts")
  .post(body)
  .addHeader("content-type", "application/json")
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:api_key/subaccounts")
  .header("content-type", "application/json")
  .body("{\n  \"name\": \"\",\n  \"secret\": \"\",\n  \"use_primary_account_balance\": false\n}")
  .asString();
const data = JSON.stringify({
  name: '',
  secret: '',
  use_primary_account_balance: false
});

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('POST', '{{baseUrl}}/:api_key/subaccounts');
xhr.setRequestHeader('content-type', 'application/json');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'POST',
  url: '{{baseUrl}}/:api_key/subaccounts',
  headers: {'content-type': 'application/json'},
  data: {name: '', secret: '', use_primary_account_balance: false}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/:api_key/subaccounts';
const options = {
  method: 'POST',
  headers: {'content-type': 'application/json'},
  body: '{"name":"","secret":"","use_primary_account_balance":false}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
const settings = {
  async: true,
  crossDomain: true,
  url: '{{baseUrl}}/:api_key/subaccounts',
  method: 'POST',
  headers: {
    'content-type': 'application/json'
  },
  processData: false,
  data: '{\n  "name": "",\n  "secret": "",\n  "use_primary_account_balance": false\n}'
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n  \"name\": \"\",\n  \"secret\": \"\",\n  \"use_primary_account_balance\": false\n}")
val request = Request.Builder()
  .url("{{baseUrl}}/:api_key/subaccounts")
  .post(body)
  .addHeader("content-type", "application/json")
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'POST',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/:api_key/subaccounts',
  headers: {
    'content-type': 'application/json'
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on('data', function (chunk) {
    chunks.push(chunk);
  });

  res.on('end', function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({name: '', secret: '', use_primary_account_balance: false}));
req.end();
const request = require('request');

const options = {
  method: 'POST',
  url: '{{baseUrl}}/:api_key/subaccounts',
  headers: {'content-type': 'application/json'},
  body: {name: '', secret: '', use_primary_account_balance: false},
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('POST', '{{baseUrl}}/:api_key/subaccounts');

req.headers({
  'content-type': 'application/json'
});

req.type('json');
req.send({
  name: '',
  secret: '',
  use_primary_account_balance: false
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'POST',
  url: '{{baseUrl}}/:api_key/subaccounts',
  headers: {'content-type': 'application/json'},
  data: {name: '', secret: '', use_primary_account_balance: false}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/:api_key/subaccounts';
const options = {
  method: 'POST',
  headers: {'content-type': 'application/json'},
  body: '{"name":"","secret":"","use_primary_account_balance":false}'
};

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

NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"name": @"",
                              @"secret": @"",
                              @"use_primary_account_balance": @NO };

NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:api_key/subaccounts"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                if (error) {
                                                    NSLog(@"%@", error);
                                                } else {
                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
                                                    NSLog(@"%@", httpResponse);
                                                }
                                            }];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt

let uri = Uri.of_string "{{baseUrl}}/:api_key/subaccounts" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n  \"name\": \"\",\n  \"secret\": \"\",\n  \"use_primary_account_balance\": false\n}" in

Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/:api_key/subaccounts",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'name' => '',
    'secret' => '',
    'use_primary_account_balance' => null
  ]),
  CURLOPT_HTTPHEADER => [
    "content-type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('POST', '{{baseUrl}}/:api_key/subaccounts', [
  'body' => '{
  "name": "",
  "secret": "",
  "use_primary_account_balance": false
}',
  'headers' => [
    'content-type' => 'application/json',
  ],
]);

echo $response->getBody();
setUrl('{{baseUrl}}/:api_key/subaccounts');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders([
  'content-type' => 'application/json'
]);

$request->setContentType('application/json');
$request->setBody(json_encode([
  'name' => '',
  'secret' => '',
  'use_primary_account_balance' => null
]));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
append(json_encode([
  'name' => '',
  'secret' => '',
  'use_primary_account_balance' => null
]));
$request->setRequestUrl('{{baseUrl}}/:api_key/subaccounts');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders([
  'content-type' => 'application/json'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:api_key/subaccounts' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
  "name": "",
  "secret": "",
  "use_primary_account_balance": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:api_key/subaccounts' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
  "name": "",
  "secret": "",
  "use_primary_account_balance": false
}'
import http.client

conn = http.client.HTTPSConnection("example.com")

payload = "{\n  \"name\": \"\",\n  \"secret\": \"\",\n  \"use_primary_account_balance\": false\n}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/baseUrl/:api_key/subaccounts", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/:api_key/subaccounts"

payload = {
    "name": "",
    "secret": "",
    "use_primary_account_balance": False
}
headers = {"content-type": "application/json"}

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

print(response.json())
library(httr)

url <- "{{baseUrl}}/:api_key/subaccounts"

payload <- "{\n  \"name\": \"\",\n  \"secret\": \"\",\n  \"use_primary_account_balance\": false\n}"

encode <- "json"

response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/:api_key/subaccounts")

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

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n  \"name\": \"\",\n  \"secret\": \"\",\n  \"use_primary_account_balance\": false\n}"

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
  headers: {'Content-Type' => 'application/json'}
)

response = conn.post('/baseUrl/:api_key/subaccounts') do |req|
  req.body = "{\n  \"name\": \"\",\n  \"secret\": \"\",\n  \"use_primary_account_balance\": false\n}"
end

puts response.status
puts response.body
use serde_json::json;
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/:api_key/subaccounts";

    let payload = json!({
        "name": "",
        "secret": "",
        "use_primary_account_balance": false
    });

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("content-type", "application/json".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.post(url)
        .headers(headers)
        .json(&payload)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request POST \
  --url {{baseUrl}}/:api_key/subaccounts \
  --header 'content-type: application/json' \
  --data '{
  "name": "",
  "secret": "",
  "use_primary_account_balance": false
}'
echo '{
  "name": "",
  "secret": "",
  "use_primary_account_balance": false
}' |  \
  http POST {{baseUrl}}/:api_key/subaccounts \
  content-type:application/json
wget --quiet \
  --method POST \
  --header 'content-type: application/json' \
  --body-data '{\n  "name": "",\n  "secret": "",\n  "use_primary_account_balance": false\n}' \
  --output-document \
  - {{baseUrl}}/:api_key/subaccounts
import Foundation

let headers = ["content-type": "application/json"]
let parameters = [
  "name": "",
  "secret": "",
  "use_primary_account_balance": false
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:api_key/subaccounts")! 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()
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "You did not provide correct credentials",
  "instance": "798b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Invalid credentials supplied",
  "type": "https://developer.nexmo.com/api-errors#unauthorized"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "Account acc6111f is not provisioned to access Subaccount Provisioning API",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Authorisation error",
  "type": "https://developer.nexmo.com/api-errors#unprovisioned"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "API key 'acc6111f' does not exist, or you do not have access",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Invalid API Key",
  "type": "https://developer.nexmo.com/api-errors#invalid-api-key"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "The request failed due to validation errors",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Bad Request",
  "type": "https://developer.nexmo.com/api-errors/subaccounts#validation"
}
PATCH Modify a subaccount
{{baseUrl}}/:api_key/subaccounts/:subaccount_key
QUERY PARAMS

api_key
subaccount_key
BODY json

{
  "name": "",
  "suspended": false,
  "use_primary_account_balance": false
}
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:api_key/subaccounts/:subaccount_key");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n  \"name\": \"\",\n  \"suspended\": false,\n  \"use_primary_account_balance\": false\n}");

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/patch "{{baseUrl}}/:api_key/subaccounts/:subaccount_key" {:content-type :json
                                                                                  :form-params {:name ""
                                                                                                :suspended false
                                                                                                :use_primary_account_balance false}})
require "http/client"

url = "{{baseUrl}}/:api_key/subaccounts/:subaccount_key"
headers = HTTP::Headers{
  "content-type" => "application/json"
}
reqBody = "{\n  \"name\": \"\",\n  \"suspended\": false,\n  \"use_primary_account_balance\": false\n}"

response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Patch,
    RequestUri = new Uri("{{baseUrl}}/:api_key/subaccounts/:subaccount_key"),
    Content = new StringContent("{\n  \"name\": \"\",\n  \"suspended\": false,\n  \"use_primary_account_balance\": false\n}")
    {
        Headers =
        {
            ContentType = new MediaTypeHeaderValue("application/json")
        }
    }
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:api_key/subaccounts/:subaccount_key");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"\",\n  \"suspended\": false,\n  \"use_primary_account_balance\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main

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

func main() {

	url := "{{baseUrl}}/:api_key/subaccounts/:subaccount_key"

	payload := strings.NewReader("{\n  \"name\": \"\",\n  \"suspended\": false,\n  \"use_primary_account_balance\": false\n}")

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

	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))

}
PATCH /baseUrl/:api_key/subaccounts/:subaccount_key HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 78

{
  "name": "",
  "suspended": false,
  "use_primary_account_balance": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/:api_key/subaccounts/:subaccount_key")
  .setHeader("content-type", "application/json")
  .setBody("{\n  \"name\": \"\",\n  \"suspended\": false,\n  \"use_primary_account_balance\": false\n}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/:api_key/subaccounts/:subaccount_key"))
    .header("content-type", "application/json")
    .method("PATCH", HttpRequest.BodyPublishers.ofString("{\n  \"name\": \"\",\n  \"suspended\": false,\n  \"use_primary_account_balance\": false\n}"))
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"name\": \"\",\n  \"suspended\": false,\n  \"use_primary_account_balance\": false\n}");
Request request = new Request.Builder()
  .url("{{baseUrl}}/:api_key/subaccounts/:subaccount_key")
  .patch(body)
  .addHeader("content-type", "application/json")
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/:api_key/subaccounts/:subaccount_key")
  .header("content-type", "application/json")
  .body("{\n  \"name\": \"\",\n  \"suspended\": false,\n  \"use_primary_account_balance\": false\n}")
  .asString();
const data = JSON.stringify({
  name: '',
  suspended: false,
  use_primary_account_balance: false
});

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('PATCH', '{{baseUrl}}/:api_key/subaccounts/:subaccount_key');
xhr.setRequestHeader('content-type', 'application/json');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'PATCH',
  url: '{{baseUrl}}/:api_key/subaccounts/:subaccount_key',
  headers: {'content-type': 'application/json'},
  data: {name: '', suspended: false, use_primary_account_balance: false}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/:api_key/subaccounts/:subaccount_key';
const options = {
  method: 'PATCH',
  headers: {'content-type': 'application/json'},
  body: '{"name":"","suspended":false,"use_primary_account_balance":false}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
const settings = {
  async: true,
  crossDomain: true,
  url: '{{baseUrl}}/:api_key/subaccounts/:subaccount_key',
  method: 'PATCH',
  headers: {
    'content-type': 'application/json'
  },
  processData: false,
  data: '{\n  "name": "",\n  "suspended": false,\n  "use_primary_account_balance": false\n}'
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n  \"name\": \"\",\n  \"suspended\": false,\n  \"use_primary_account_balance\": false\n}")
val request = Request.Builder()
  .url("{{baseUrl}}/:api_key/subaccounts/:subaccount_key")
  .patch(body)
  .addHeader("content-type", "application/json")
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'PATCH',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/:api_key/subaccounts/:subaccount_key',
  headers: {
    'content-type': 'application/json'
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on('data', function (chunk) {
    chunks.push(chunk);
  });

  res.on('end', function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({name: '', suspended: false, use_primary_account_balance: false}));
req.end();
const request = require('request');

const options = {
  method: 'PATCH',
  url: '{{baseUrl}}/:api_key/subaccounts/:subaccount_key',
  headers: {'content-type': 'application/json'},
  body: {name: '', suspended: false, use_primary_account_balance: false},
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('PATCH', '{{baseUrl}}/:api_key/subaccounts/:subaccount_key');

req.headers({
  'content-type': 'application/json'
});

req.type('json');
req.send({
  name: '',
  suspended: false,
  use_primary_account_balance: false
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'PATCH',
  url: '{{baseUrl}}/:api_key/subaccounts/:subaccount_key',
  headers: {'content-type': 'application/json'},
  data: {name: '', suspended: false, use_primary_account_balance: false}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/:api_key/subaccounts/:subaccount_key';
const options = {
  method: 'PATCH',
  headers: {'content-type': 'application/json'},
  body: '{"name":"","suspended":false,"use_primary_account_balance":false}'
};

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

NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"name": @"",
                              @"suspended": @NO,
                              @"use_primary_account_balance": @NO };

NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:api_key/subaccounts/:subaccount_key"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                if (error) {
                                                    NSLog(@"%@", error);
                                                } else {
                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
                                                    NSLog(@"%@", httpResponse);
                                                }
                                            }];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt

let uri = Uri.of_string "{{baseUrl}}/:api_key/subaccounts/:subaccount_key" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n  \"name\": \"\",\n  \"suspended\": false,\n  \"use_primary_account_balance\": false\n}" in

Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/:api_key/subaccounts/:subaccount_key",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PATCH",
  CURLOPT_POSTFIELDS => json_encode([
    'name' => '',
    'suspended' => null,
    'use_primary_account_balance' => null
  ]),
  CURLOPT_HTTPHEADER => [
    "content-type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('PATCH', '{{baseUrl}}/:api_key/subaccounts/:subaccount_key', [
  'body' => '{
  "name": "",
  "suspended": false,
  "use_primary_account_balance": false
}',
  'headers' => [
    'content-type' => 'application/json',
  ],
]);

echo $response->getBody();
setUrl('{{baseUrl}}/:api_key/subaccounts/:subaccount_key');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);

$request->setHeaders([
  'content-type' => 'application/json'
]);

$request->setContentType('application/json');
$request->setBody(json_encode([
  'name' => '',
  'suspended' => null,
  'use_primary_account_balance' => null
]));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
append(json_encode([
  'name' => '',
  'suspended' => null,
  'use_primary_account_balance' => null
]));
$request->setRequestUrl('{{baseUrl}}/:api_key/subaccounts/:subaccount_key');
$request->setRequestMethod('PATCH');
$request->setBody($body);

$request->setHeaders([
  'content-type' => 'application/json'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:api_key/subaccounts/:subaccount_key' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
  "name": "",
  "suspended": false,
  "use_primary_account_balance": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:api_key/subaccounts/:subaccount_key' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
  "name": "",
  "suspended": false,
  "use_primary_account_balance": false
}'
import http.client

conn = http.client.HTTPSConnection("example.com")

payload = "{\n  \"name\": \"\",\n  \"suspended\": false,\n  \"use_primary_account_balance\": false\n}"

headers = { 'content-type': "application/json" }

conn.request("PATCH", "/baseUrl/:api_key/subaccounts/:subaccount_key", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/:api_key/subaccounts/:subaccount_key"

payload = {
    "name": "",
    "suspended": False,
    "use_primary_account_balance": False
}
headers = {"content-type": "application/json"}

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

print(response.json())
library(httr)

url <- "{{baseUrl}}/:api_key/subaccounts/:subaccount_key"

payload <- "{\n  \"name\": \"\",\n  \"suspended\": false,\n  \"use_primary_account_balance\": false\n}"

encode <- "json"

response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/:api_key/subaccounts/:subaccount_key")

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

request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n  \"name\": \"\",\n  \"suspended\": false,\n  \"use_primary_account_balance\": false\n}"

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
  headers: {'Content-Type' => 'application/json'}
)

response = conn.patch('/baseUrl/:api_key/subaccounts/:subaccount_key') do |req|
  req.body = "{\n  \"name\": \"\",\n  \"suspended\": false,\n  \"use_primary_account_balance\": false\n}"
end

puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/:api_key/subaccounts/:subaccount_key";

    let payload = json!({
        "name": "",
        "suspended": false,
        "use_primary_account_balance": false
    });

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("content-type", "application/json".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
        .headers(headers)
        .json(&payload)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request PATCH \
  --url {{baseUrl}}/:api_key/subaccounts/:subaccount_key \
  --header 'content-type: application/json' \
  --data '{
  "name": "",
  "suspended": false,
  "use_primary_account_balance": false
}'
echo '{
  "name": "",
  "suspended": false,
  "use_primary_account_balance": false
}' |  \
  http PATCH {{baseUrl}}/:api_key/subaccounts/:subaccount_key \
  content-type:application/json
wget --quiet \
  --method PATCH \
  --header 'content-type: application/json' \
  --body-data '{\n  "name": "",\n  "suspended": false,\n  "use_primary_account_balance": false\n}' \
  --output-document \
  - {{baseUrl}}/:api_key/subaccounts/:subaccount_key
import Foundation

let headers = ["content-type": "application/json"]
let parameters = [
  "name": "",
  "suspended": false,
  "use_primary_account_balance": false
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:api_key/subaccounts/:subaccount_key")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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()
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "You did not provide correct credentials",
  "instance": "798b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Invalid credentials supplied",
  "type": "https://developer.nexmo.com/api-errors#unauthorized"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "Account acc6111f is not provisioned to access Subaccount Provisioning API",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Authorisation error",
  "type": "https://developer.nexmo.com/api-errors#unprovisioned"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "API key 'acc6111f' does not exist, or you do not have access",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Invalid API Key",
  "type": "https://developer.nexmo.com/api-errors#invalid-api-key"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "The request failed due to validation errors",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Bad Request",
  "type": "https://developer.nexmo.com/api-errors/subaccounts#validation"
}
GET Retrieve a subaccount
{{baseUrl}}/:api_key/subaccounts/:subaccount_key
QUERY PARAMS

api_key
subaccount_key
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:api_key/subaccounts/:subaccount_key");

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/get "{{baseUrl}}/:api_key/subaccounts/:subaccount_key")
require "http/client"

url = "{{baseUrl}}/:api_key/subaccounts/:subaccount_key"

response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("{{baseUrl}}/:api_key/subaccounts/:subaccount_key"),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:api_key/subaccounts/:subaccount_key");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main

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

func main() {

	url := "{{baseUrl}}/:api_key/subaccounts/:subaccount_key"

	req, _ := http.NewRequest("GET", url, nil)

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

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

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

}
GET /baseUrl/:api_key/subaccounts/:subaccount_key HTTP/1.1
Host: example.com

AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/:api_key/subaccounts/:subaccount_key")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/:api_key/subaccounts/:subaccount_key"))
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{{baseUrl}}/:api_key/subaccounts/:subaccount_key")
  .get()
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/:api_key/subaccounts/:subaccount_key")
  .asString();
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', '{{baseUrl}}/:api_key/subaccounts/:subaccount_key');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'GET',
  url: '{{baseUrl}}/:api_key/subaccounts/:subaccount_key'
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/:api_key/subaccounts/:subaccount_key';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
const settings = {
  async: true,
  crossDomain: true,
  url: '{{baseUrl}}/:api_key/subaccounts/:subaccount_key',
  method: 'GET',
  headers: {}
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val request = Request.Builder()
  .url("{{baseUrl}}/:api_key/subaccounts/:subaccount_key")
  .get()
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'GET',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/:api_key/subaccounts/:subaccount_key',
  headers: {}
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on('data', function (chunk) {
    chunks.push(chunk);
  });

  res.on('end', function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
const request = require('request');

const options = {
  method: 'GET',
  url: '{{baseUrl}}/:api_key/subaccounts/:subaccount_key'
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('GET', '{{baseUrl}}/:api_key/subaccounts/:subaccount_key');

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'GET',
  url: '{{baseUrl}}/:api_key/subaccounts/:subaccount_key'
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/:api_key/subaccounts/:subaccount_key';
const options = {method: 'GET'};

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

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:api_key/subaccounts/:subaccount_key"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                if (error) {
                                                    NSLog(@"%@", error);
                                                } else {
                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
                                                    NSLog(@"%@", httpResponse);
                                                }
                                            }];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt

let uri = Uri.of_string "{{baseUrl}}/:api_key/subaccounts/:subaccount_key" in

Client.call `GET uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/:api_key/subaccounts/:subaccount_key",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('GET', '{{baseUrl}}/:api_key/subaccounts/:subaccount_key');

echo $response->getBody();
setUrl('{{baseUrl}}/:api_key/subaccounts/:subaccount_key');
$request->setMethod(HTTP_METH_GET);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
setRequestUrl('{{baseUrl}}/:api_key/subaccounts/:subaccount_key');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:api_key/subaccounts/:subaccount_key' -Method GET 
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:api_key/subaccounts/:subaccount_key' -Method GET 
import http.client

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/baseUrl/:api_key/subaccounts/:subaccount_key")

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/:api_key/subaccounts/:subaccount_key"

response = requests.get(url)

print(response.json())
library(httr)

url <- "{{baseUrl}}/:api_key/subaccounts/:subaccount_key"

response <- VERB("GET", url, content_type("application/octet-stream"))

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/:api_key/subaccounts/:subaccount_key")

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

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
)

response = conn.get('/baseUrl/:api_key/subaccounts/:subaccount_key') do |req|
end

puts response.status
puts response.body
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/:api_key/subaccounts/:subaccount_key";

    let client = reqwest::Client::new();
    let response = client.get(url)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request GET \
  --url {{baseUrl}}/:api_key/subaccounts/:subaccount_key
http GET {{baseUrl}}/:api_key/subaccounts/:subaccount_key
wget --quiet \
  --method GET \
  --output-document \
  - {{baseUrl}}/:api_key/subaccounts/:subaccount_key
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:api_key/subaccounts/:subaccount_key")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

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()
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "You did not provide correct credentials",
  "instance": "798b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Invalid credentials supplied",
  "type": "https://developer.nexmo.com/api-errors#unauthorized"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "Account acc6111f is not provisioned to access Subaccount Provisioning API",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Authorisation error",
  "type": "https://developer.nexmo.com/api-errors#unprovisioned"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "API key 'acc6111f' does not exist, or you do not have access",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Invalid API Key",
  "type": "https://developer.nexmo.com/api-errors#invalid-api-key"
}
GET Retrieve list of subaccounts
{{baseUrl}}/:api_key/subaccounts
QUERY PARAMS

api_key
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:api_key/subaccounts");

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/get "{{baseUrl}}/:api_key/subaccounts")
require "http/client"

url = "{{baseUrl}}/:api_key/subaccounts"

response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("{{baseUrl}}/:api_key/subaccounts"),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:api_key/subaccounts");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main

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

func main() {

	url := "{{baseUrl}}/:api_key/subaccounts"

	req, _ := http.NewRequest("GET", url, nil)

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

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

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

}
GET /baseUrl/:api_key/subaccounts HTTP/1.1
Host: example.com

AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/:api_key/subaccounts")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/:api_key/subaccounts"))
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{{baseUrl}}/:api_key/subaccounts")
  .get()
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/:api_key/subaccounts")
  .asString();
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', '{{baseUrl}}/:api_key/subaccounts');

xhr.send(data);
import axios from 'axios';

const options = {method: 'GET', url: '{{baseUrl}}/:api_key/subaccounts'};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/:api_key/subaccounts';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
const settings = {
  async: true,
  crossDomain: true,
  url: '{{baseUrl}}/:api_key/subaccounts',
  method: 'GET',
  headers: {}
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val request = Request.Builder()
  .url("{{baseUrl}}/:api_key/subaccounts")
  .get()
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'GET',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/:api_key/subaccounts',
  headers: {}
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on('data', function (chunk) {
    chunks.push(chunk);
  });

  res.on('end', function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
const request = require('request');

const options = {method: 'GET', url: '{{baseUrl}}/:api_key/subaccounts'};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('GET', '{{baseUrl}}/:api_key/subaccounts');

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {method: 'GET', url: '{{baseUrl}}/:api_key/subaccounts'};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/:api_key/subaccounts';
const options = {method: 'GET'};

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

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:api_key/subaccounts"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                if (error) {
                                                    NSLog(@"%@", error);
                                                } else {
                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
                                                    NSLog(@"%@", httpResponse);
                                                }
                                            }];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt

let uri = Uri.of_string "{{baseUrl}}/:api_key/subaccounts" in

Client.call `GET uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/:api_key/subaccounts",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('GET', '{{baseUrl}}/:api_key/subaccounts');

echo $response->getBody();
setUrl('{{baseUrl}}/:api_key/subaccounts');
$request->setMethod(HTTP_METH_GET);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
setRequestUrl('{{baseUrl}}/:api_key/subaccounts');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:api_key/subaccounts' -Method GET 
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:api_key/subaccounts' -Method GET 
import http.client

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/baseUrl/:api_key/subaccounts")

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/:api_key/subaccounts"

response = requests.get(url)

print(response.json())
library(httr)

url <- "{{baseUrl}}/:api_key/subaccounts"

response <- VERB("GET", url, content_type("application/octet-stream"))

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/:api_key/subaccounts")

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

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
)

response = conn.get('/baseUrl/:api_key/subaccounts') do |req|
end

puts response.status
puts response.body
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/:api_key/subaccounts";

    let client = reqwest::Client::new();
    let response = client.get(url)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request GET \
  --url {{baseUrl}}/:api_key/subaccounts
http GET {{baseUrl}}/:api_key/subaccounts
wget --quiet \
  --method GET \
  --output-document \
  - {{baseUrl}}/:api_key/subaccounts
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:api_key/subaccounts")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

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()
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "You did not provide correct credentials",
  "instance": "798b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Invalid credentials supplied",
  "type": "https://developer.nexmo.com/api-errors#unauthorized"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "Account acc6111f is not provisioned to access Subaccount Provisioning API",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Authorisation error",
  "type": "https://developer.nexmo.com/api-errors#unprovisioned"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "API key 'acc6111f' does not exist, or you do not have access",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Invalid API Key",
  "type": "https://developer.nexmo.com/api-errors#invalid-api-key"
}
GET Retrieve list of balance transfers
{{baseUrl}}/:api_key/balance-transfers
QUERY PARAMS

start_date
api_key
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:api_key/balance-transfers?start_date=");

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/get "{{baseUrl}}/:api_key/balance-transfers" {:query-params {:start_date ""}})
require "http/client"

url = "{{baseUrl}}/:api_key/balance-transfers?start_date="

response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("{{baseUrl}}/:api_key/balance-transfers?start_date="),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:api_key/balance-transfers?start_date=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main

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

func main() {

	url := "{{baseUrl}}/:api_key/balance-transfers?start_date="

	req, _ := http.NewRequest("GET", url, nil)

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

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

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

}
GET /baseUrl/:api_key/balance-transfers?start_date= HTTP/1.1
Host: example.com

AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/:api_key/balance-transfers?start_date=")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/:api_key/balance-transfers?start_date="))
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{{baseUrl}}/:api_key/balance-transfers?start_date=")
  .get()
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/:api_key/balance-transfers?start_date=")
  .asString();
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', '{{baseUrl}}/:api_key/balance-transfers?start_date=');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'GET',
  url: '{{baseUrl}}/:api_key/balance-transfers',
  params: {start_date: ''}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/:api_key/balance-transfers?start_date=';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
const settings = {
  async: true,
  crossDomain: true,
  url: '{{baseUrl}}/:api_key/balance-transfers?start_date=',
  method: 'GET',
  headers: {}
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val request = Request.Builder()
  .url("{{baseUrl}}/:api_key/balance-transfers?start_date=")
  .get()
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'GET',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/:api_key/balance-transfers?start_date=',
  headers: {}
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on('data', function (chunk) {
    chunks.push(chunk);
  });

  res.on('end', function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
const request = require('request');

const options = {
  method: 'GET',
  url: '{{baseUrl}}/:api_key/balance-transfers',
  qs: {start_date: ''}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('GET', '{{baseUrl}}/:api_key/balance-transfers');

req.query({
  start_date: ''
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'GET',
  url: '{{baseUrl}}/:api_key/balance-transfers',
  params: {start_date: ''}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/:api_key/balance-transfers?start_date=';
const options = {method: 'GET'};

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

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:api_key/balance-transfers?start_date="]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                if (error) {
                                                    NSLog(@"%@", error);
                                                } else {
                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
                                                    NSLog(@"%@", httpResponse);
                                                }
                                            }];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt

let uri = Uri.of_string "{{baseUrl}}/:api_key/balance-transfers?start_date=" in

Client.call `GET uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/:api_key/balance-transfers?start_date=",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('GET', '{{baseUrl}}/:api_key/balance-transfers?start_date=');

echo $response->getBody();
setUrl('{{baseUrl}}/:api_key/balance-transfers');
$request->setMethod(HTTP_METH_GET);

$request->setQueryData([
  'start_date' => ''
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
setRequestUrl('{{baseUrl}}/:api_key/balance-transfers');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
  'start_date' => ''
]));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:api_key/balance-transfers?start_date=' -Method GET 
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:api_key/balance-transfers?start_date=' -Method GET 
import http.client

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/baseUrl/:api_key/balance-transfers?start_date=")

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/:api_key/balance-transfers"

querystring = {"start_date":""}

response = requests.get(url, params=querystring)

print(response.json())
library(httr)

url <- "{{baseUrl}}/:api_key/balance-transfers"

queryString <- list(start_date = "")

response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/:api_key/balance-transfers?start_date=")

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

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
)

response = conn.get('/baseUrl/:api_key/balance-transfers') do |req|
  req.params['start_date'] = ''
end

puts response.status
puts response.body
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/:api_key/balance-transfers";

    let querystring = [
        ("start_date", ""),
    ];

    let client = reqwest::Client::new();
    let response = client.get(url)
        .query(&querystring)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request GET \
  --url '{{baseUrl}}/:api_key/balance-transfers?start_date='
http GET '{{baseUrl}}/:api_key/balance-transfers?start_date='
wget --quiet \
  --method GET \
  --output-document \
  - '{{baseUrl}}/:api_key/balance-transfers?start_date='
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:api_key/balance-transfers?start_date=")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

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()
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "You did not provide correct credentials",
  "instance": "798b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Invalid credentials supplied",
  "type": "https://developer.nexmo.com/api-errors#unauthorized"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "Account acc6111f is not provisioned to access Subaccount Provisioning API",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Authorisation error",
  "type": "https://developer.nexmo.com/api-errors#unprovisioned"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "API key 'acc6111f' does not exist, or you do not have access",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Invalid API Key",
  "type": "https://developer.nexmo.com/api-errors#invalid-api-key"
}
GET Retrieve list of credit transfers
{{baseUrl}}/:api_key/credit-transfers
QUERY PARAMS

start_date
api_key
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:api_key/credit-transfers?start_date=");

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/get "{{baseUrl}}/:api_key/credit-transfers" {:query-params {:start_date ""}})
require "http/client"

url = "{{baseUrl}}/:api_key/credit-transfers?start_date="

response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("{{baseUrl}}/:api_key/credit-transfers?start_date="),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:api_key/credit-transfers?start_date=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main

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

func main() {

	url := "{{baseUrl}}/:api_key/credit-transfers?start_date="

	req, _ := http.NewRequest("GET", url, nil)

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

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

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

}
GET /baseUrl/:api_key/credit-transfers?start_date= HTTP/1.1
Host: example.com

AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/:api_key/credit-transfers?start_date=")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/:api_key/credit-transfers?start_date="))
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{{baseUrl}}/:api_key/credit-transfers?start_date=")
  .get()
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/:api_key/credit-transfers?start_date=")
  .asString();
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('GET', '{{baseUrl}}/:api_key/credit-transfers?start_date=');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'GET',
  url: '{{baseUrl}}/:api_key/credit-transfers',
  params: {start_date: ''}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/:api_key/credit-transfers?start_date=';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
const settings = {
  async: true,
  crossDomain: true,
  url: '{{baseUrl}}/:api_key/credit-transfers?start_date=',
  method: 'GET',
  headers: {}
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val request = Request.Builder()
  .url("{{baseUrl}}/:api_key/credit-transfers?start_date=")
  .get()
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'GET',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/:api_key/credit-transfers?start_date=',
  headers: {}
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on('data', function (chunk) {
    chunks.push(chunk);
  });

  res.on('end', function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
const request = require('request');

const options = {
  method: 'GET',
  url: '{{baseUrl}}/:api_key/credit-transfers',
  qs: {start_date: ''}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('GET', '{{baseUrl}}/:api_key/credit-transfers');

req.query({
  start_date: ''
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'GET',
  url: '{{baseUrl}}/:api_key/credit-transfers',
  params: {start_date: ''}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/:api_key/credit-transfers?start_date=';
const options = {method: 'GET'};

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

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:api_key/credit-transfers?start_date="]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                if (error) {
                                                    NSLog(@"%@", error);
                                                } else {
                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
                                                    NSLog(@"%@", httpResponse);
                                                }
                                            }];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt

let uri = Uri.of_string "{{baseUrl}}/:api_key/credit-transfers?start_date=" in

Client.call `GET uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/:api_key/credit-transfers?start_date=",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('GET', '{{baseUrl}}/:api_key/credit-transfers?start_date=');

echo $response->getBody();
setUrl('{{baseUrl}}/:api_key/credit-transfers');
$request->setMethod(HTTP_METH_GET);

$request->setQueryData([
  'start_date' => ''
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
setRequestUrl('{{baseUrl}}/:api_key/credit-transfers');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
  'start_date' => ''
]));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:api_key/credit-transfers?start_date=' -Method GET 
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:api_key/credit-transfers?start_date=' -Method GET 
import http.client

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/baseUrl/:api_key/credit-transfers?start_date=")

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/:api_key/credit-transfers"

querystring = {"start_date":""}

response = requests.get(url, params=querystring)

print(response.json())
library(httr)

url <- "{{baseUrl}}/:api_key/credit-transfers"

queryString <- list(start_date = "")

response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/:api_key/credit-transfers?start_date=")

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

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
)

response = conn.get('/baseUrl/:api_key/credit-transfers') do |req|
  req.params['start_date'] = ''
end

puts response.status
puts response.body
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/:api_key/credit-transfers";

    let querystring = [
        ("start_date", ""),
    ];

    let client = reqwest::Client::new();
    let response = client.get(url)
        .query(&querystring)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request GET \
  --url '{{baseUrl}}/:api_key/credit-transfers?start_date='
http GET '{{baseUrl}}/:api_key/credit-transfers?start_date='
wget --quiet \
  --method GET \
  --output-document \
  - '{{baseUrl}}/:api_key/credit-transfers?start_date='
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:api_key/credit-transfers?start_date=")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

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()
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "You did not provide correct credentials",
  "instance": "798b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Invalid credentials supplied",
  "type": "https://developer.nexmo.com/api-errors#unauthorized"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "Account acc6111f is not provisioned to access Subaccount Provisioning API",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Authorisation error",
  "type": "https://developer.nexmo.com/api-errors#unprovisioned"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "API key 'acc6111f' does not exist, or you do not have access",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Invalid API Key",
  "type": "https://developer.nexmo.com/api-errors#invalid-api-key"
}
POST Transfer balance
{{baseUrl}}/:api_key/balance-transfers
QUERY PARAMS

api_key
BODY json

{
  "amount": "",
  "from": "",
  "reference": "",
  "to": ""
}
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:api_key/balance-transfers");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}");

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/post "{{baseUrl}}/:api_key/balance-transfers" {:content-type :json
                                                                       :form-params {:amount ""
                                                                                     :from ""
                                                                                     :reference ""
                                                                                     :to ""}})
require "http/client"

url = "{{baseUrl}}/:api_key/balance-transfers"
headers = HTTP::Headers{
  "content-type" => "application/json"
}
reqBody = "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}"

response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("{{baseUrl}}/:api_key/balance-transfers"),
    Content = new StringContent("{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}")
    {
        Headers =
        {
            ContentType = new MediaTypeHeaderValue("application/json")
        }
    }
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:api_key/balance-transfers");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main

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

func main() {

	url := "{{baseUrl}}/:api_key/balance-transfers"

	payload := strings.NewReader("{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}")

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

	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))

}
POST /baseUrl/:api_key/balance-transfers HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 63

{
  "amount": "",
  "from": "",
  "reference": "",
  "to": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:api_key/balance-transfers")
  .setHeader("content-type", "application/json")
  .setBody("{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/:api_key/balance-transfers"))
    .header("content-type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}"))
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}");
Request request = new Request.Builder()
  .url("{{baseUrl}}/:api_key/balance-transfers")
  .post(body)
  .addHeader("content-type", "application/json")
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:api_key/balance-transfers")
  .header("content-type", "application/json")
  .body("{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}")
  .asString();
const data = JSON.stringify({
  amount: '',
  from: '',
  reference: '',
  to: ''
});

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('POST', '{{baseUrl}}/:api_key/balance-transfers');
xhr.setRequestHeader('content-type', 'application/json');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'POST',
  url: '{{baseUrl}}/:api_key/balance-transfers',
  headers: {'content-type': 'application/json'},
  data: {amount: '', from: '', reference: '', to: ''}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/:api_key/balance-transfers';
const options = {
  method: 'POST',
  headers: {'content-type': 'application/json'},
  body: '{"amount":"","from":"","reference":"","to":""}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
const settings = {
  async: true,
  crossDomain: true,
  url: '{{baseUrl}}/:api_key/balance-transfers',
  method: 'POST',
  headers: {
    'content-type': 'application/json'
  },
  processData: false,
  data: '{\n  "amount": "",\n  "from": "",\n  "reference": "",\n  "to": ""\n}'
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}")
val request = Request.Builder()
  .url("{{baseUrl}}/:api_key/balance-transfers")
  .post(body)
  .addHeader("content-type", "application/json")
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'POST',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/:api_key/balance-transfers',
  headers: {
    'content-type': 'application/json'
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on('data', function (chunk) {
    chunks.push(chunk);
  });

  res.on('end', function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({amount: '', from: '', reference: '', to: ''}));
req.end();
const request = require('request');

const options = {
  method: 'POST',
  url: '{{baseUrl}}/:api_key/balance-transfers',
  headers: {'content-type': 'application/json'},
  body: {amount: '', from: '', reference: '', to: ''},
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('POST', '{{baseUrl}}/:api_key/balance-transfers');

req.headers({
  'content-type': 'application/json'
});

req.type('json');
req.send({
  amount: '',
  from: '',
  reference: '',
  to: ''
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'POST',
  url: '{{baseUrl}}/:api_key/balance-transfers',
  headers: {'content-type': 'application/json'},
  data: {amount: '', from: '', reference: '', to: ''}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/:api_key/balance-transfers';
const options = {
  method: 'POST',
  headers: {'content-type': 'application/json'},
  body: '{"amount":"","from":"","reference":"","to":""}'
};

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

NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"amount": @"",
                              @"from": @"",
                              @"reference": @"",
                              @"to": @"" };

NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:api_key/balance-transfers"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                if (error) {
                                                    NSLog(@"%@", error);
                                                } else {
                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
                                                    NSLog(@"%@", httpResponse);
                                                }
                                            }];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt

let uri = Uri.of_string "{{baseUrl}}/:api_key/balance-transfers" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}" in

Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/:api_key/balance-transfers",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'amount' => '',
    'from' => '',
    'reference' => '',
    'to' => ''
  ]),
  CURLOPT_HTTPHEADER => [
    "content-type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('POST', '{{baseUrl}}/:api_key/balance-transfers', [
  'body' => '{
  "amount": "",
  "from": "",
  "reference": "",
  "to": ""
}',
  'headers' => [
    'content-type' => 'application/json',
  ],
]);

echo $response->getBody();
setUrl('{{baseUrl}}/:api_key/balance-transfers');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders([
  'content-type' => 'application/json'
]);

$request->setContentType('application/json');
$request->setBody(json_encode([
  'amount' => '',
  'from' => '',
  'reference' => '',
  'to' => ''
]));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
append(json_encode([
  'amount' => '',
  'from' => '',
  'reference' => '',
  'to' => ''
]));
$request->setRequestUrl('{{baseUrl}}/:api_key/balance-transfers');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders([
  'content-type' => 'application/json'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:api_key/balance-transfers' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
  "amount": "",
  "from": "",
  "reference": "",
  "to": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:api_key/balance-transfers' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
  "amount": "",
  "from": "",
  "reference": "",
  "to": ""
}'
import http.client

conn = http.client.HTTPSConnection("example.com")

payload = "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/baseUrl/:api_key/balance-transfers", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/:api_key/balance-transfers"

payload = {
    "amount": "",
    "from": "",
    "reference": "",
    "to": ""
}
headers = {"content-type": "application/json"}

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

print(response.json())
library(httr)

url <- "{{baseUrl}}/:api_key/balance-transfers"

payload <- "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}"

encode <- "json"

response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/:api_key/balance-transfers")

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

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}"

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
  headers: {'Content-Type' => 'application/json'}
)

response = conn.post('/baseUrl/:api_key/balance-transfers') do |req|
  req.body = "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}"
end

puts response.status
puts response.body
use serde_json::json;
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/:api_key/balance-transfers";

    let payload = json!({
        "amount": "",
        "from": "",
        "reference": "",
        "to": ""
    });

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("content-type", "application/json".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.post(url)
        .headers(headers)
        .json(&payload)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request POST \
  --url {{baseUrl}}/:api_key/balance-transfers \
  --header 'content-type: application/json' \
  --data '{
  "amount": "",
  "from": "",
  "reference": "",
  "to": ""
}'
echo '{
  "amount": "",
  "from": "",
  "reference": "",
  "to": ""
}' |  \
  http POST {{baseUrl}}/:api_key/balance-transfers \
  content-type:application/json
wget --quiet \
  --method POST \
  --header 'content-type: application/json' \
  --body-data '{\n  "amount": "",\n  "from": "",\n  "reference": "",\n  "to": ""\n}' \
  --output-document \
  - {{baseUrl}}/:api_key/balance-transfers
import Foundation

let headers = ["content-type": "application/json"]
let parameters = [
  "amount": "",
  "from": "",
  "reference": "",
  "to": ""
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:api_key/balance-transfers")! 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()
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "You did not provide correct credentials",
  "instance": "798b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Invalid credentials supplied",
  "type": "https://developer.nexmo.com/api-errors#unauthorized"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "Account acc6111f is not provisioned to access Subaccount Provisioning API",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Authorisation error",
  "type": "https://developer.nexmo.com/api-errors#unprovisioned"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "API key 'acc6111f' does not exist, or you do not have access",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Invalid API Key",
  "type": "https://developer.nexmo.com/api-errors#invalid-api-key"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "The request failed due to validation errors",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Bad Request",
  "type": "https://developer.nexmo.com/api-errors/subaccounts#validation"
}
POST Transfer credit
{{baseUrl}}/:api_key/credit-transfers
QUERY PARAMS

api_key
BODY json

{
  "amount": "",
  "from": "",
  "reference": "",
  "to": ""
}
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:api_key/credit-transfers");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}");

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/post "{{baseUrl}}/:api_key/credit-transfers" {:content-type :json
                                                                      :form-params {:amount ""
                                                                                    :from ""
                                                                                    :reference ""
                                                                                    :to ""}})
require "http/client"

url = "{{baseUrl}}/:api_key/credit-transfers"
headers = HTTP::Headers{
  "content-type" => "application/json"
}
reqBody = "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}"

response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("{{baseUrl}}/:api_key/credit-transfers"),
    Content = new StringContent("{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}")
    {
        Headers =
        {
            ContentType = new MediaTypeHeaderValue("application/json")
        }
    }
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:api_key/credit-transfers");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main

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

func main() {

	url := "{{baseUrl}}/:api_key/credit-transfers"

	payload := strings.NewReader("{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}")

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

	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))

}
POST /baseUrl/:api_key/credit-transfers HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 63

{
  "amount": "",
  "from": "",
  "reference": "",
  "to": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:api_key/credit-transfers")
  .setHeader("content-type", "application/json")
  .setBody("{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/:api_key/credit-transfers"))
    .header("content-type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}"))
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}");
Request request = new Request.Builder()
  .url("{{baseUrl}}/:api_key/credit-transfers")
  .post(body)
  .addHeader("content-type", "application/json")
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:api_key/credit-transfers")
  .header("content-type", "application/json")
  .body("{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}")
  .asString();
const data = JSON.stringify({
  amount: '',
  from: '',
  reference: '',
  to: ''
});

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('POST', '{{baseUrl}}/:api_key/credit-transfers');
xhr.setRequestHeader('content-type', 'application/json');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'POST',
  url: '{{baseUrl}}/:api_key/credit-transfers',
  headers: {'content-type': 'application/json'},
  data: {amount: '', from: '', reference: '', to: ''}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/:api_key/credit-transfers';
const options = {
  method: 'POST',
  headers: {'content-type': 'application/json'},
  body: '{"amount":"","from":"","reference":"","to":""}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
const settings = {
  async: true,
  crossDomain: true,
  url: '{{baseUrl}}/:api_key/credit-transfers',
  method: 'POST',
  headers: {
    'content-type': 'application/json'
  },
  processData: false,
  data: '{\n  "amount": "",\n  "from": "",\n  "reference": "",\n  "to": ""\n}'
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}")
val request = Request.Builder()
  .url("{{baseUrl}}/:api_key/credit-transfers")
  .post(body)
  .addHeader("content-type", "application/json")
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'POST',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/:api_key/credit-transfers',
  headers: {
    'content-type': 'application/json'
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on('data', function (chunk) {
    chunks.push(chunk);
  });

  res.on('end', function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({amount: '', from: '', reference: '', to: ''}));
req.end();
const request = require('request');

const options = {
  method: 'POST',
  url: '{{baseUrl}}/:api_key/credit-transfers',
  headers: {'content-type': 'application/json'},
  body: {amount: '', from: '', reference: '', to: ''},
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('POST', '{{baseUrl}}/:api_key/credit-transfers');

req.headers({
  'content-type': 'application/json'
});

req.type('json');
req.send({
  amount: '',
  from: '',
  reference: '',
  to: ''
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'POST',
  url: '{{baseUrl}}/:api_key/credit-transfers',
  headers: {'content-type': 'application/json'},
  data: {amount: '', from: '', reference: '', to: ''}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/:api_key/credit-transfers';
const options = {
  method: 'POST',
  headers: {'content-type': 'application/json'},
  body: '{"amount":"","from":"","reference":"","to":""}'
};

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

NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"amount": @"",
                              @"from": @"",
                              @"reference": @"",
                              @"to": @"" };

NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:api_key/credit-transfers"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                if (error) {
                                                    NSLog(@"%@", error);
                                                } else {
                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
                                                    NSLog(@"%@", httpResponse);
                                                }
                                            }];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt

let uri = Uri.of_string "{{baseUrl}}/:api_key/credit-transfers" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}" in

Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/:api_key/credit-transfers",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'amount' => '',
    'from' => '',
    'reference' => '',
    'to' => ''
  ]),
  CURLOPT_HTTPHEADER => [
    "content-type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('POST', '{{baseUrl}}/:api_key/credit-transfers', [
  'body' => '{
  "amount": "",
  "from": "",
  "reference": "",
  "to": ""
}',
  'headers' => [
    'content-type' => 'application/json',
  ],
]);

echo $response->getBody();
setUrl('{{baseUrl}}/:api_key/credit-transfers');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders([
  'content-type' => 'application/json'
]);

$request->setContentType('application/json');
$request->setBody(json_encode([
  'amount' => '',
  'from' => '',
  'reference' => '',
  'to' => ''
]));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
append(json_encode([
  'amount' => '',
  'from' => '',
  'reference' => '',
  'to' => ''
]));
$request->setRequestUrl('{{baseUrl}}/:api_key/credit-transfers');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders([
  'content-type' => 'application/json'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:api_key/credit-transfers' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
  "amount": "",
  "from": "",
  "reference": "",
  "to": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:api_key/credit-transfers' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
  "amount": "",
  "from": "",
  "reference": "",
  "to": ""
}'
import http.client

conn = http.client.HTTPSConnection("example.com")

payload = "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/baseUrl/:api_key/credit-transfers", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/:api_key/credit-transfers"

payload = {
    "amount": "",
    "from": "",
    "reference": "",
    "to": ""
}
headers = {"content-type": "application/json"}

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

print(response.json())
library(httr)

url <- "{{baseUrl}}/:api_key/credit-transfers"

payload <- "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}"

encode <- "json"

response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/:api_key/credit-transfers")

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

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}"

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
  headers: {'Content-Type' => 'application/json'}
)

response = conn.post('/baseUrl/:api_key/credit-transfers') do |req|
  req.body = "{\n  \"amount\": \"\",\n  \"from\": \"\",\n  \"reference\": \"\",\n  \"to\": \"\"\n}"
end

puts response.status
puts response.body
use serde_json::json;
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/:api_key/credit-transfers";

    let payload = json!({
        "amount": "",
        "from": "",
        "reference": "",
        "to": ""
    });

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("content-type", "application/json".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.post(url)
        .headers(headers)
        .json(&payload)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request POST \
  --url {{baseUrl}}/:api_key/credit-transfers \
  --header 'content-type: application/json' \
  --data '{
  "amount": "",
  "from": "",
  "reference": "",
  "to": ""
}'
echo '{
  "amount": "",
  "from": "",
  "reference": "",
  "to": ""
}' |  \
  http POST {{baseUrl}}/:api_key/credit-transfers \
  content-type:application/json
wget --quiet \
  --method POST \
  --header 'content-type: application/json' \
  --body-data '{\n  "amount": "",\n  "from": "",\n  "reference": "",\n  "to": ""\n}' \
  --output-document \
  - {{baseUrl}}/:api_key/credit-transfers
import Foundation

let headers = ["content-type": "application/json"]
let parameters = [
  "amount": "",
  "from": "",
  "reference": "",
  "to": ""
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:api_key/credit-transfers")! 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()
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "You did not provide correct credentials",
  "instance": "798b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Invalid credentials supplied",
  "type": "https://developer.nexmo.com/api-errors#unauthorized"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "Account acc6111f is not provisioned to access Subaccount Provisioning API",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Authorisation error",
  "type": "https://developer.nexmo.com/api-errors#unprovisioned"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "API key 'acc6111f' does not exist, or you do not have access",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Invalid API Key",
  "type": "https://developer.nexmo.com/api-errors#invalid-api-key"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "The request failed due to validation errors",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Bad Request",
  "type": "https://developer.nexmo.com/api-errors/subaccounts#validation"
}
POST Transfer number
{{baseUrl}}/:api_key/transfer-number
QUERY PARAMS

api_key
BODY json

{
  "country": "",
  "from": "",
  "number": "",
  "to": ""
}
Examples
REQUEST

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:api_key/transfer-number");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n  \"country\": \"\",\n  \"from\": \"\",\n  \"number\": \"\",\n  \"to\": \"\"\n}");

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/post "{{baseUrl}}/:api_key/transfer-number" {:content-type :json
                                                                     :form-params {:country ""
                                                                                   :from ""
                                                                                   :number ""
                                                                                   :to ""}})
require "http/client"

url = "{{baseUrl}}/:api_key/transfer-number"
headers = HTTP::Headers{
  "content-type" => "application/json"
}
reqBody = "{\n  \"country\": \"\",\n  \"from\": \"\",\n  \"number\": \"\",\n  \"to\": \"\"\n}"

response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("{{baseUrl}}/:api_key/transfer-number"),
    Content = new StringContent("{\n  \"country\": \"\",\n  \"from\": \"\",\n  \"number\": \"\",\n  \"to\": \"\"\n}")
    {
        Headers =
        {
            ContentType = new MediaTypeHeaderValue("application/json")
        }
    }
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:api_key/transfer-number");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n  \"country\": \"\",\n  \"from\": \"\",\n  \"number\": \"\",\n  \"to\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main

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

func main() {

	url := "{{baseUrl}}/:api_key/transfer-number"

	payload := strings.NewReader("{\n  \"country\": \"\",\n  \"from\": \"\",\n  \"number\": \"\",\n  \"to\": \"\"\n}")

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

	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))

}
POST /baseUrl/:api_key/transfer-number HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 61

{
  "country": "",
  "from": "",
  "number": "",
  "to": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:api_key/transfer-number")
  .setHeader("content-type", "application/json")
  .setBody("{\n  \"country\": \"\",\n  \"from\": \"\",\n  \"number\": \"\",\n  \"to\": \"\"\n}")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("{{baseUrl}}/:api_key/transfer-number"))
    .header("content-type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\n  \"country\": \"\",\n  \"from\": \"\",\n  \"number\": \"\",\n  \"to\": \"\"\n}"))
    .build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"country\": \"\",\n  \"from\": \"\",\n  \"number\": \"\",\n  \"to\": \"\"\n}");
Request request = new Request.Builder()
  .url("{{baseUrl}}/:api_key/transfer-number")
  .post(body)
  .addHeader("content-type", "application/json")
  .build();

Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:api_key/transfer-number")
  .header("content-type", "application/json")
  .body("{\n  \"country\": \"\",\n  \"from\": \"\",\n  \"number\": \"\",\n  \"to\": \"\"\n}")
  .asString();
const data = JSON.stringify({
  country: '',
  from: '',
  number: '',
  to: ''
});

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('POST', '{{baseUrl}}/:api_key/transfer-number');
xhr.setRequestHeader('content-type', 'application/json');

xhr.send(data);
import axios from 'axios';

const options = {
  method: 'POST',
  url: '{{baseUrl}}/:api_key/transfer-number',
  headers: {'content-type': 'application/json'},
  data: {country: '', from: '', number: '', to: ''}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const url = '{{baseUrl}}/:api_key/transfer-number';
const options = {
  method: 'POST',
  headers: {'content-type': 'application/json'},
  body: '{"country":"","from":"","number":"","to":""}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
const settings = {
  async: true,
  crossDomain: true,
  url: '{{baseUrl}}/:api_key/transfer-number',
  method: 'POST',
  headers: {
    'content-type': 'application/json'
  },
  processData: false,
  data: '{\n  "country": "",\n  "from": "",\n  "number": "",\n  "to": ""\n}'
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
val client = OkHttpClient()

val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n  \"country\": \"\",\n  \"from\": \"\",\n  \"number\": \"\",\n  \"to\": \"\"\n}")
val request = Request.Builder()
  .url("{{baseUrl}}/:api_key/transfer-number")
  .post(body)
  .addHeader("content-type", "application/json")
  .build()

val response = client.newCall(request).execute()
const http = require('https');

const options = {
  method: 'POST',
  hostname: 'example.com',
  port: null,
  path: '/baseUrl/:api_key/transfer-number',
  headers: {
    'content-type': 'application/json'
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on('data', function (chunk) {
    chunks.push(chunk);
  });

  res.on('end', function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({country: '', from: '', number: '', to: ''}));
req.end();
const request = require('request');

const options = {
  method: 'POST',
  url: '{{baseUrl}}/:api_key/transfer-number',
  headers: {'content-type': 'application/json'},
  body: {country: '', from: '', number: '', to: ''},
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
const unirest = require('unirest');

const req = unirest('POST', '{{baseUrl}}/:api_key/transfer-number');

req.headers({
  'content-type': 'application/json'
});

req.type('json');
req.send({
  country: '',
  from: '',
  number: '',
  to: ''
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
const axios = require('axios').default;

const options = {
  method: 'POST',
  url: '{{baseUrl}}/:api_key/transfer-number',
  headers: {'content-type': 'application/json'},
  data: {country: '', from: '', number: '', to: ''}
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}
const fetch = require('node-fetch');

const url = '{{baseUrl}}/:api_key/transfer-number';
const options = {
  method: 'POST',
  headers: {'content-type': 'application/json'},
  body: '{"country":"","from":"","number":"","to":""}'
};

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

NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"country": @"",
                              @"from": @"",
                              @"number": @"",
                              @"to": @"" };

NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:api_key/transfer-number"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                if (error) {
                                                    NSLog(@"%@", error);
                                                } else {
                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
                                                    NSLog(@"%@", httpResponse);
                                                }
                                            }];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt

let uri = Uri.of_string "{{baseUrl}}/:api_key/transfer-number" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n  \"country\": \"\",\n  \"from\": \"\",\n  \"number\": \"\",\n  \"to\": \"\"\n}" in

Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
 "{{baseUrl}}/:api_key/transfer-number",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'country' => '',
    'from' => '',
    'number' => '',
    'to' => ''
  ]),
  CURLOPT_HTTPHEADER => [
    "content-type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
request('POST', '{{baseUrl}}/:api_key/transfer-number', [
  'body' => '{
  "country": "",
  "from": "",
  "number": "",
  "to": ""
}',
  'headers' => [
    'content-type' => 'application/json',
  ],
]);

echo $response->getBody();
setUrl('{{baseUrl}}/:api_key/transfer-number');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders([
  'content-type' => 'application/json'
]);

$request->setContentType('application/json');
$request->setBody(json_encode([
  'country' => '',
  'from' => '',
  'number' => '',
  'to' => ''
]));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
append(json_encode([
  'country' => '',
  'from' => '',
  'number' => '',
  'to' => ''
]));
$request->setRequestUrl('{{baseUrl}}/:api_key/transfer-number');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders([
  'content-type' => 'application/json'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:api_key/transfer-number' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
  "country": "",
  "from": "",
  "number": "",
  "to": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:api_key/transfer-number' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
  "country": "",
  "from": "",
  "number": "",
  "to": ""
}'
import http.client

conn = http.client.HTTPSConnection("example.com")

payload = "{\n  \"country\": \"\",\n  \"from\": \"\",\n  \"number\": \"\",\n  \"to\": \"\"\n}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/baseUrl/:api_key/transfer-number", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "{{baseUrl}}/:api_key/transfer-number"

payload = {
    "country": "",
    "from": "",
    "number": "",
    "to": ""
}
headers = {"content-type": "application/json"}

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

print(response.json())
library(httr)

url <- "{{baseUrl}}/:api_key/transfer-number"

payload <- "{\n  \"country\": \"\",\n  \"from\": \"\",\n  \"number\": \"\",\n  \"to\": \"\"\n}"

encode <- "json"

response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)

content(response, "text")
require 'uri'
require 'net/http'

url = URI("{{baseUrl}}/:api_key/transfer-number")

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

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n  \"country\": \"\",\n  \"from\": \"\",\n  \"number\": \"\",\n  \"to\": \"\"\n}"

response = http.request(request)
puts response.read_body
require 'faraday'

conn = Faraday.new(
  url: 'https://example.com',
  headers: {'Content-Type' => 'application/json'}
)

response = conn.post('/baseUrl/:api_key/transfer-number') do |req|
  req.body = "{\n  \"country\": \"\",\n  \"from\": \"\",\n  \"number\": \"\",\n  \"to\": \"\"\n}"
end

puts response.status
puts response.body
use serde_json::json;
use reqwest;

#[tokio::main]
pub async fn main() {
    let url = "{{baseUrl}}/:api_key/transfer-number";

    let payload = json!({
        "country": "",
        "from": "",
        "number": "",
        "to": ""
    });

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("content-type", "application/json".parse().unwrap());

    let client = reqwest::Client::new();
    let response = client.post(url)
        .headers(headers)
        .json(&payload)
        .send()
        .await;

    let results = response.unwrap()
        .json::()
        .await
        .unwrap();

    dbg!(results);
}
curl --request POST \
  --url {{baseUrl}}/:api_key/transfer-number \
  --header 'content-type: application/json' \
  --data '{
  "country": "",
  "from": "",
  "number": "",
  "to": ""
}'
echo '{
  "country": "",
  "from": "",
  "number": "",
  "to": ""
}' |  \
  http POST {{baseUrl}}/:api_key/transfer-number \
  content-type:application/json
wget --quiet \
  --method POST \
  --header 'content-type: application/json' \
  --body-data '{\n  "country": "",\n  "from": "",\n  "number": "",\n  "to": ""\n}' \
  --output-document \
  - {{baseUrl}}/:api_key/transfer-number
import Foundation

let headers = ["content-type": "application/json"]
let parameters = [
  "country": "",
  "from": "",
  "number": "",
  "to": ""
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:api_key/transfer-number")! 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()
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "You did not provide correct credentials",
  "instance": "798b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Invalid credentials supplied",
  "type": "https://developer.nexmo.com/api-errors#unauthorized"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "Could not transfer number {number} from account {from} to {to} - ShortCode is already owned by requesting account",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Transfer Conflict",
  "type": "https://developer.nexmo.com/api-errors/subaccounts#transfer-conflict"
}
RESPONSE HEADERS

Content-Type
application/json
RESPONSE BODY json

{
  "detail": "The request failed due to validation errors",
  "instance": "158b8f199c45014ab7b08bfe9cc1c12c",
  "title": "Bad Request",
  "type": "https://developer.nexmo.com/api-errors/subaccounts#validation"
}