Skip to main content
POST
/
sandbox
/
connections
JavaScript
import Finch from '@tryfinch/finch-api';

const client = new Finch({
  clientID: process.env['FINCH_CLIENT_ID'], // This is the default and can be omitted
  clientSecret: process.env['FINCH_CLIENT_SECRET'], // This is the default and can be omitted
});

const connection = await client.sandbox.connections.create({ provider_id: 'provider_id' });

console.log(connection.account_id);
import os
from finch import Finch

client = Finch(
client_id=os.environ.get("FINCH_CLIENT_ID"), # This is the default and can be omitted
client_secret=os.environ.get("FINCH_CLIENT_SECRET"), # This is the default and can be omitted
)
connection = client.sandbox.connections.create(
provider_id="provider_id",
)
print(connection.account_id)
package main

import (
"context"
"fmt"

"github.com/Finch-API/finch-api-go"
"github.com/Finch-API/finch-api-go/option"
)

func main() {
client := finchgo.NewClient(
option.WithClientID("4ab15e51-11ad-49f4-acae-f343b7794375"),
option.WithClientSecret("My Client Secret"),
)
connection, err := client.Sandbox.Connections.New(context.TODO(), finchgo.SandboxConnectionNewParams{
ProviderID: finchgo.F("provider_id"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", connection.AccountID)
}
package com.tryfinch.api.example;

import com.tryfinch.api.client.FinchClient;
import com.tryfinch.api.client.okhttp.FinchOkHttpClient;
import com.tryfinch.api.models.ConnectionCreateResponse;
import com.tryfinch.api.models.SandboxConnectionCreateParams;

public final class Main {
private Main() {}

public static void main(String[] args) {
FinchClient client = FinchOkHttpClient.fromEnv();

SandboxConnectionCreateParams params = SandboxConnectionCreateParams.builder()
.providerId("provider_id")
.build();
ConnectionCreateResponse connection = client.sandbox().connections().create(params);
}
}
package com.tryfinch.api.example

import com.tryfinch.api.client.FinchClient
import com.tryfinch.api.client.okhttp.FinchOkHttpClient
import com.tryfinch.api.models.ConnectionCreateResponse
import com.tryfinch.api.models.SandboxConnectionCreateParams

fun main() {
val client: FinchClient = FinchOkHttpClient.fromEnv()

val params: SandboxConnectionCreateParams = SandboxConnectionCreateParams.builder()
.providerId("provider_id")
.build()
val connection: ConnectionCreateResponse = client.sandbox().connections().create(params)
}
require "finch_api"

finch = FinchAPI::Client.new(client_id: "4ab15e51-11ad-49f4-acae-f343b7794375", client_secret: "My Client Secret")

connection = finch.sandbox.connections.create(provider_id: "provider_id")

puts(connection)
curl --request POST \
--url https://api.tryfinch.com/sandbox/connections \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"provider_id": "<string>",
"products": [
"<string>"
],
"employee_size": 123
}
'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tryfinch.com/sandbox/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([
'provider_id' => '<string>',
'products' => [
'<string>'
],
'employee_size' => 123
]),
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;
}
{
  "connection_id": "a237a1c3-1a5e-44ae-a8fd-81f76fd715c2",
  "entity_id": "449e7a5c-69d3-4b8a-aaaf-5c9b713ebc65",
  "company_id": "b2e6a1c3-1a5e-44ae-a8fd-81f76fd715cf",
  "account_id": "449e7a5c-69d3-4b8a-aaaf-5c9b713ebc65",
  "provider_id": "gusto",
  "authentication_type": "api_token",
  "products": [
    "company",
    "directory",
    "individual"
  ],
  "access_token": "7eb55bcf-6593-4040-afac-252ee1f78e20",
  "token_type": "bearer"
}

Authorizations

Authorization
string
header
required

Please use base64 encoded client_id:client_secret

Body

application/json
provider_id
string
required

The provider associated with the connection

authentication_type
enum<string>
Available options:
credential,
api_token,
oauth,
assisted
products
string[]
employee_size
integer

Optional: the size of the employer to be created with this connection. Defaults to 20. Note that if this is higher than 100, historical payroll data will not be generated, and instead only one pay period will be created.

Response

200 - application/json

OK

connection_id
string<uuid>
required

The ID of the new connection

entity_id
string<uuid>
required

The ID of the entity for this connection

company_id
string<uuid>
required

The Finch UUID of the company associated with the access_token.

provider_id
string<uuid>
required

The ID of the provider associated with the access_token.

account_id
string<uuid>
required
deprecated

[DEPRECATED] Use connection_id to associate a connection with an access token

authentication_type
enum<string>
required
Available options:
credential,
api_token,
oauth,
assisted
products
string[]
required
access_token
string<uuid>
required
token_type
string