POST
/
auth
/
token
import Finch from '@tryfinch/finch-api';

const client = new Finch({
  accessToken: 'My Access Token',
});

async function main() {
  const createAccessTokenResponse = await client.accessTokens.create({ code: '<your_authorization_code>' });

  console.log(createAccessTokenResponse.account_id);
}

main();
{
  "access_token": "7e965183-9332-423c-9259-3edafb332ad2",
  "token_type": "bearer",
  "connection_id": "bc3a2af9-ce03-46c4-9142-81abe789c64d",
  "customer_id": "1234567890",
  "account_id": "ac3a2af9-ce03-46c4-9142-81abe789c64d",
  "client_type": "production",
  "company_id": "4ab15e51-11ad-49f4-acae-f343b7794375",
  "connection_type": "provider",
  "products": [
    "directory",
    "employment",
    "individual"
  ],
  "provider_id": "gusto"
}

Headers

Finch-API-Version
string
default:
2020-09-17
required

Header used to specify the version for a given API request. Current version is 2020-09-17.

Content-Type
string
default:
application/json
required

Used to indicate the original media type of the resource

Body

application/json
client_id
string
required
client_secret
string
required
code
string
required
redirect_uri
string

Response

200 - application/json
Access Token
access_token
string
required

The access token for the connection.

connection_id
string
required

The Finch UUID of the connection associated with the access_token.

account_id
string
requireddeprecated

[DEPRECATED] Use connection_id to identify the connection instead of this account ID.

client_type
enum<string>
required

The type of application associated with a token.

Available options:
production,
development,
sandbox
company_id
string
requireddeprecated

[DEPRECATED] Use connection_id to identify the connection instead of this company ID.

connection_type
enum<string>
required

The type of the connection associated with the token.

  • provider - connection to an external provider
  • finch - finch-generated data.
Available options:
provider,
finch
products
string[]
required

An array of the authorized products associated with the access_token.

provider_id
string
required

The ID of the provider associated with the access_token.

token_type
string

The RFC 8693 token type (Finch uses bearer tokens)

customer_id
string | null

The ID of your customer you provided to Finch when a connect session was created for this connection.