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/v2"
"github.com/Finch-API/finch-api-go/v2/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"
}Sandbox
Create a new Sandbox Connection
Create a new connection (new company/provider pair) with a new account
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/v2"
"github.com/Finch-API/finch-api-go/v2/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"
}Body
application/json
Response
200 - application/json
OK
Was this page helpful?