Skip to main content
POST
/
connections
Create a new connection
curl --request POST \
  --url https://qubesync.com/api/v1/connections \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "redirect_url": "https://myapp.com/quickbooks-setup-callback"
}
'
import requests

url = "https://qubesync.com/api/v1/connections"

payload = {
"name": "<string>",
"redirect_url": "https://myapp.com/quickbooks-setup-callback"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', redirect_url: 'https://myapp.com/quickbooks-setup-callback'})
};

fetch('https://qubesync.com/api/v1/connections', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://qubesync.com/api/v1/connections",
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' => '<string>',
'redirect_url' => 'https://myapp.com/quickbooks-setup-callback'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);

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

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://qubesync.com/api/v1/connections"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"redirect_url\": \"https://myapp.com/quickbooks-setup-callback\"\n}")

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

req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://qubesync.com/api/v1/connections")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"redirect_url\": \"https://myapp.com/quickbooks-setup-callback\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://qubesync.com/api/v1/connections")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"redirect_url\": \"https://myapp.com/quickbooks-setup-callback\"\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "app_id": "550e8400-e29b-41d4-a716-446655440000",
    "username": "550e8400-e29b-41d4-a716-446655440001",
    "name": "My Customer Inc.",
    "last_connected_at": null,
    "company_file": null,
    "type": "standard",
    "qbxml_version": null,
    "quickbooks_product_name": null,
    "redirect_url": "https://myapp.com/quickbooks-setup-callback",
    "links": {
      "self": "/api/v1/connections/123e4567-e89b-12d3-a456-426614174000",
      "ui": "/app/connections/123e4567-e89b-12d3-a456-426614174000",
      "onboarding": "https://qubesync.com/onboarding/abcdef123456"
    },
    "inserted_at": "2023-01-01T12:00:00Z",
    "updated_at": "2023-01-01T12:00:00Z"
  }
}
{
"error": {
"code": "unauthorized",
"message": "Authentication required"
}
}

Authorizations

Authorization
string
header
required

Use your app's API_KEY as the username, and leave the password blank

Body

application/json
name
string

Optional name for the connection - if you leave this blank, the company name returned by QuickBooks will be used once the first request is processed

redirect_url
string<uri>

The URL to redirect the user to after they complete (or cancel) the QuickBooks setup process. This URL should be able to handle the query parameters:

  • ?state=connected if they completed the process,
  • ?state=cancelled if they cancelled it or
  • ?state=expired if they visit the onboarding link after it has expired
Example:

"https://myapp.com/quickbooks-setup-callback"

Response

Connection created successfully

data
object