### Quick Example: Get Accounts Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/README.md Demonstrates how to create and configure the Plaid client, set authentication headers and environment, and retrieve account information. Handles potential Plaid API errors. ```go package main import ( "context" "github.com/plaid/plaid-go/v42/plaid" ) func main() { // Create and configure client cfg := plaid.NewConfiguration() cfg.AddDefaultHeader("PLAID-CLIENT-ID", "your_client_id") cfg.AddDefaultHeader("PLAID-SECRET", "your_secret") cfg.UseEnvironment(plaid.Sandbox) client := plaid.NewAPIClient(cfg) ctx := context.Background() // Get accounts request := plaid.NewAccountsGetRequest("access_token") response, _, err := client.PlaidApi.AccountsGet(ctx). AccountsGetRequest(*request). Execute() if err != nil { plaidErr, _ := plaid.ToPlaidError(err) println("Error:", plaidErr.ErrorCode) return } for _, account := range response.GetAccounts() { println("Account:", account.GetName()) } } ``` -------------------------------- ### Install Plaid Go SDK Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/README.md Command to install the latest version of the Plaid Go SDK using go get. ```bash go get github.com/plaid/plaid-go/v42@latest ``` -------------------------------- ### Install Plaid Go Client Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/quick-start.md Install the Plaid Go client library using go get. Ensure your go.mod file is updated with the correct version. ```bash go get github.com/plaid/plaid-go/v42@latest ``` ```go require github.com/plaid/plaid-go/v42 v42.2.0 ``` -------------------------------- ### Example: Initialize Plaid Client and Make API Call Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/configuration.md Demonstrates setting up client ID, secret, and environment, then creating a client and executing an AccountsGet request. ```go import ( "context" "github.com/plaid/plaid-go/v42/plaid" ) configuration := plaid.NewConfiguration() configuration.AddDefaultHeader("PLAID-CLIENT-ID", "your_client_id") configuration.AddDefaultHeader("PLAID-SECRET", "your_secret") configuration.UseEnvironment(plaid.Production) client := plaid.NewAPIClient(configuration) // Now use client.PlaidApi to make endpoint calls ctx := context.Background() response, httpResponse, err := client.PlaidApi.AccountsGet(ctx).AccountsGetRequest( *plaid.NewAccountsGetRequest("access_token"), ).Execute() ``` -------------------------------- ### Get Balances (Old Way) Source: https://github.com/plaid/plaid-go/blob/master/README.md Retrieves account balances using the older `GetBalances` and `GetBalancesWithOptions` methods. ```go // get balances for all accounts balanceResp, err := client.GetBalances(accessToken) // get balances for selected accounts options := GetBalancesOptions{ AccountIDs: []string{balanceResp.Accounts[0].AccountID}, } balanceResp, err = client.GetBalancesWithOptions(accessToken, options) ``` -------------------------------- ### Basic Plaid Client Setup in Go Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/quick-start.md Set up the Plaid client with your API credentials and environment. This involves creating a configuration, adding headers for client ID and secret, and specifying the environment (Sandbox or Production). ```go package main import ( "context" "fmt" "os" "github.com/plaid/plaid-go/v42/plaid" ) func main() { // Create configuration configuration := plaid.NewConfiguration() configuration.AddDefaultHeader("PLAID-CLIENT-ID", os.Getenv("PLAID_CLIENT_ID")) configuration.AddDefaultHeader("PLAID-SECRET", os.Getenv("PLAID_SECRET")) configuration.UseEnvironment(plaid.Sandbox) // or plaid.Production // Create client client := plaid.NewAPIClient(configuration) ctx := context.Background() // Make API calls // ... } ``` -------------------------------- ### Initialize Link Token Creation Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/key-endpoints.md This example demonstrates how to construct and execute a LinkTokenCreate request. It sets up user details, specifies products like Auth and Transactions, and configures a webhook. Ensure the client is properly initialized before use. ```go user := plaid.LinkTokenCreateRequestUser{ ClientUserId: "user_123", LegalName: plaid.PtrString("John Doe"), EmailAddress: plaid.PtrString("john@example.com"), } request := plaid.NewLinkTokenCreateRequest( "My Financial App", "en", []plaid.CountryCode{plaid.COUNTRYCODE_US}, user, ) request.SetProducts([]plaid.Products{ plaid.PRODUCTS_AUTH, plaid.PRODUCTS_TRANSACTIONS, }) request.SetWebhook("https://example.com/webhook") response, _, err := client.PlaidApi.LinkTokenCreate(ctx). LinkTokenCreateRequest(*request). Execute() if err == nil { fmt.Println("Link Token:", response.GetLinkToken()) fmt.Println("Expires:", response.GetExpiration()) } ``` -------------------------------- ### Example Usage of AccountsGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/key-endpoints.md Demonstrates how to make an AccountsGet request using the Plaid Go client, optionally filtering by account IDs, and processing the response. ```go request := plaid.NewAccountsGetRequest(accessToken) // Optional: filter to specific accounts options := plaid.AccountsGetRequestOptions{ AccountIds: []string{"account_id_123"}, } request.SetOptions(options) response, _, err := client.PlaidApi.AccountsGet(ctx). AccountsGetRequest(*request). Execute() if err == nil { for _, account := range response.GetAccounts() { fmt.Printf("ID: %s\n", account.GetAccountId()) fmt.Printf("Name: %s\n", account.GetName()) fmt.Printf("Type: %s\n", account.GetType()) balances := account.GetBalances() fmt.Printf("Balance: $%.2f\n", balances.GetCurrent()) } } ``` -------------------------------- ### PaymentInitiationConsentGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Retrieve details for a specific payment initiation consent. Use this endpoint to get the status and details of a consent. ```APIDOC ## PaymentInitiationConsentGet ### Description Retrieve details for a specific payment initiation consent. Use this endpoint to get the status and details of a consent. ### Method POST ### Endpoint /payment_initiation/consent/get ### Request Body - **PaymentInitiationConsentGetRequest** (object) - Required - The request body for retrieving consent details. ### Response #### Success Response (200) - **PaymentInitiationConsentGetResponse** (object) - The response object containing consent details. ``` -------------------------------- ### Configuring Pagination for Transactions Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/client.md Demonstrates how to use request options to control pagination, specifying the number of items per page and the starting offset. ```go request := plaid.NewTransactionsGetRequest(accessToken, startDate, endDate) options := plaid.TransactionsGetRequestOptions{ Count: plaid.PtrInt32(100), // Items per page Offset: plaid.PtrInt32(0), // Starting position } request.SetOptions(options) response, _, err := client.PlaidApi.TransactionsGet(ctx). TransactionsGetRequest(*request). Execute() ``` -------------------------------- ### Install plaid-go with Go Modules Source: https://github.com/plaid/plaid-go/blob/master/README.md Use this command to add the plaid-go library to your project's go.mod file. Ensure you replace {VERSION} with the desired library version. ```console go get github.com/plaid/plaid-go/v42@{VERSION} ``` -------------------------------- ### Get Transactions with Optional Parameters (Old Way) Source: https://github.com/plaid/plaid-go/blob/master/README.md Retrieves transactions, demonstrating both basic usage and the use of `GetTransactionsWithOptions` for optional parameters. ```go const iso8601TimeFormat = "2006-01-02" startDate := time.Now().Add(-365 * 24 * time.Hour).Format(iso8601TimeFormat) endDate := time.Now().Format(iso8601TimeFormat) transactionsResp, err := client.GetTransactions(accessToken, startDate, endDate) // Or, using optional parameters: startDate := time.Now().Add(-365 * 24 * time.Hour).Format(iso8601TimeFormat) endDate := time.Now().Format(iso8601TimeFormat) options := GetTransactionsOptions{ StartDate: startDate, EndDate: endDate, AccountIDs: []string{}, Count: 2, Offset: 1, } transactionsResp, err := client.GetTransactionsWithOptions(accessToken, options) ``` -------------------------------- ### Get Balances (New Way) Source: https://github.com/plaid/plaid-go/blob/master/README.md Retrieves account balances using the new `AccountsBalanceGet` endpoint with a request model. ```go balancesGetReq := plaid.NewAccountsBalanceGetRequest(accessToken) balancesGetResp, _, err = testClient.PlaidApi.AccountsBalanceGet(ctx).AccountsBalanceGetRequest( *balancesGetReq, ).Execute() ``` -------------------------------- ### PaymentInitiationPaymentGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Retrieve details for a specific payment initiation payment. Use this endpoint to get the current status and details of a previously created payment. ```APIDOC ## PaymentInitiationPaymentGet ### Description Retrieve details for a specific payment initiation payment. Use this endpoint to get the current status and details of a previously created payment. ### Method POST ### Endpoint /payment_initiation/payment/get ### Request Body - **PaymentInitiationPaymentGetRequest** (object) - Required - The request body for retrieving payment details. ### Response #### Success Response (200) - **PaymentInitiationPaymentGetResponse** (object) - The response object containing payment details. ``` -------------------------------- ### CreditEmploymentGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Retrieve employment information. Use this endpoint to get details about a user's employment. ```APIDOC ## CreditEmploymentGet ### Description Retrieve employment information. Use this endpoint to get details about a user's employment. ### Method POST ### Endpoint /credit/employment/get ### Request Body - **CreditEmploymentGetRequest** (object) - Required - The request body for retrieving employment information. ### Response #### Success Response (200) - **CreditEmploymentGetResponse** (object) - The response object containing employment details. ``` -------------------------------- ### PaymentInitiationRecipientGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Retrieve details for a specific recipient. Use this endpoint to get information about a previously created recipient. ```APIDOC ## PaymentInitiationRecipientGet ### Description Retrieve details for a specific recipient. Use this endpoint to get information about a previously created recipient. ### Method POST ### Endpoint /payment_initiation/recipient/get ### Request Body - **PaymentInitiationRecipientGetRequest** (object) - Required - The request body for retrieving recipient details. ### Response #### Success Response (200) - **PaymentInitiationRecipientGetResponse** (object) - The response object containing recipient details. ``` -------------------------------- ### NullableString Type and Usage Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/types.md Demonstrates the usage of a custom `NullableString` type for handling optional string fields that can be explicitly set to null. Shows how to set, get, and check if a value is set. ```go type NullableString struct { value *string isSet bool } func (v NullableString) Get() *string func (v *NullableString) Set(val *string) func (v NullableString) IsSet() bool func (v *NullableString) Unset() var val plaid.NullableString val.Set(plaid.PtrString("value")) if val.IsSet() { fmt.Println(val.Get()) } ``` -------------------------------- ### Pointer Helper Functions Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/types.md Provides utility functions for creating pointers to primitive types, simplifying the process of setting optional fields in request structs. Examples include `PtrString`, `PtrInt32`, `PtrFloat32`, and `PtrBool`. ```go plaid.PtrString("value") // *string plaid.PtrInt32(42) // *int32 plaid.PtrFloat32(3.14) // *float32 plaid.PtrBool(true) // *bool ``` -------------------------------- ### Get Account Details with Real-Time Balances Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/quick-start.md Retrieve real-time balance information for accounts associated with an Item. This endpoint provides current and available balance details for each account. ```go request := plaid.NewAccountsBalanceGetRequest("access_token") response, _, err := client.PlaidApi.AccountsBalanceGet(ctx). AccountsBalanceGetRequest(*request). Execute() if err == nil { for _, account := range response.GetAccounts() { balance := account.GetBalances() fmt.Printf("%s: Current=$%.2f, Available=$%.2f\n", account.GetName(), balance.GetCurrent(), balance.GetAvailable()) } } ``` -------------------------------- ### Retrieve Transactions (Sync Method) Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/quick-start.md Get transactions for an Item using the recommended sync method. This method is efficient for retrieving incremental updates and requires a cursor. It returns transactions and the next cursor for subsequent calls. ```go // Using TransactionsSync (recommended) request := plaid.NewTransactionsSyncRequest("access_token") response, _, err := client.PlaidApi.TransactionsSync(ctx). TransactionsSyncRequest(*request). Execute() if err != nil { fmt.Println("Error:", err) return } fmt.Printf("Got %d transactions\n", len(response.GetTransactions())) fmt.Printf("Cursor: %s\n", response.GetNextCursor()) for _, txn := range response.GetTransactions() { fmt.Printf("%s: %s - $%.2f\n", txn.GetDate(), txn.GetName(), txn.GetAmount()) } ``` -------------------------------- ### Get Transactions with Optional Parameters (New Way) Source: https://github.com/plaid/plaid-go/blob/master/README.md Retrieves transactions using the new `TransactionsGet` endpoint, setting optional parameters via `TransactionsGetRequestOptions`. ```go const iso8601TimeFormat = "2006-01-02" startDate := time.Now().Add(-365 * 24 * time.Hour).Format(iso8601TimeFormat) endDate := time.Now().Format(iso8601TimeFormat) options := plaid.TransactionsGetRequestOptions{ IncludePersonalFinanceCategory := true } request.SetOptions(options) request := plaid.NewTransactionsGetRequest( accessToken, startDate, endDate, ) options := plaid.TransactionsGetRequestOptions{ Count: plaid.PtrInt32(100), Offset: plaid.PtrInt32(0), IncludePersonalFinanceCategory: true, } request.SetOptions(options) transactionsResp, _, err := testClient.PlaidApi.TransactionsGet(ctx).TransactionsGetRequest(*request).Execute() ``` -------------------------------- ### Extracting PlaidError from API Response Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/errors.md Example demonstrating how to call an API endpoint and extract a detailed PlaidError object if an error occurs. ```go response, httpResponse, err := client.PlaidApi.AccountsGet(ctx).AccountsGetRequest(*request).Execute() if err != nil { plaidErr, err := plaid.ToPlaidError(err) if err == nil { fmt.Println("Error Code:", plaidErr.ErrorCode) fmt.Println("Error Type:", plaidErr.ErrorType) fmt.Println("Message:", plaidErr.ErrorMessage) } } ``` -------------------------------- ### Retrieve Transactions (Get Method) Source: https://github.com/plaid/plaid-go/blob/master/README.md Fetches transactions using the `TransactionsGet` endpoint. This method is suitable for retrieving a historical range of transactions. ```go const iso8601TimeFormat = "2006-01-02" startDate := time.Now().Add(-365 * 24 * time.Hour).Format(iso8601TimeFormat) endDate := time.Now().Format(iso8601TimeFormat) request := plaid.NewTransactionsGetRequest( accessToken, startDate, endDate, ) options := plaid.TransactionsGetRequestOptions{ Count: plaid.PtrInt32(100), Offset: plaid.PtrInt32(0), } request.SetOptions(options) transactionsResp, _, err := testClient.PlaidApi.TransactionsGet(ctx).TransactionsGetRequest(*request).Execute() ``` -------------------------------- ### Check Specific Plaid Error Codes in Go Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/errors.md This example shows how to check for specific Plaid error codes, such as 'INVALID_ACCESS_TOKEN' or 'NO_ACCOUNTS', by type asserting the error to a GenericOpenAPIError and then to a PlaidError model. ```go if err != nil { if plaidErr, ok := err.(plaid.GenericOpenAPIError); ok { if model, ok := plaidErr.Model().(plaid.PlaidError); ok { if model.ErrorCode == "INVALID_ACCESS_TOKEN" { // Handle token refresh or re-authentication fmt.Println("Token expired, user must re-authenticate") } else if model.ErrorCode == "NO_ACCOUNTS" { fmt.Println("No matching accounts found") } } } } ``` -------------------------------- ### Get Link Token to initialize Link Source: https://github.com/plaid/plaid-go/blob/master/README.md Creates a Link Token which is used to initialize Plaid Link, enabling users to connect their accounts. This method supports specifying user information, products, customization, webhooks, redirect URIs, and account filters. ```APIDOC ## Get Link Token to initialize Link ### Description Creates a Link Token which is used to initialize Plaid Link, enabling users to connect their accounts. This method supports specifying user information, products, customization, webhooks, redirect URIs, and account filters. ### Method `POST` ### Endpoint `/link/token/create` ### Parameters #### Request Body - **client_user_id** (string) - Required - A unique ID for the end user. - **country_codes** (array of CountryCode) - Required - The Plaid country codes for which the Link server will be enabled. - **language** (string) - Required - The language to be used in Plaid Link, specified as an IETF BCP-47 language tag. - **products** (array of Products) - Required - The Plaid Products to use for the Link session. - **client_name** (string) - Optional - The name of your application that's displayed to the user. - **webhook** (string) - Optional - The URL that Plaid should call to send webhooks. - **redirect_uri** (string) - Optional - The redirect URI for the Item initialization. - **account_filters** (object) - Optional - Allows specifying account filters for the Link session. - **depository** (object) - Optional - Filters for depository accounts. - **account_subtypes** (array of AccountSubtype) - Optional - An array of account subtypes to include. ### Request Example ```json { "client_user_id": "USER_ID_FROM_YOUR_DB", "country_codes": ["US"], "language": "en", "products": ["auth"], "client_name": "Plaid Test", "webhook": "https://webhook-uri.com", "redirect_uri": "https://domainname.com/oauth-page.html", "account_filters": { "depository": { "account_subtypes": ["checking", "savings"] } } } ``` ### Response #### Success Response (200) - **link_token** (string) - The Link token. - **expiration_time** (string) - The expiration time of the token. - **request_id** (string) - A unique identifier for the request. #### Response Example ```json { "link_token": "link-token-example", "expiration_time": "2023-10-27T22:23:12Z", "request_id": "example-request-id" } ``` ``` -------------------------------- ### Setting Up Plaid Client Configuration Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/client.md Demonstrates how to configure the Plaid client with necessary authentication headers like Client ID, Secret, and API version. ```go configuration := plaid.NewConfiguration() configuration.AddDefaultHeader("PLAID-CLIENT-ID", "your_client_id") configuration.AddDefaultHeader("PLAID-SECRET", "your_secret") configuration.AddDefaultHeader("Plaid-Version", "2020-09-14") // Added automatically ``` -------------------------------- ### TransferQuestionnaireCreate Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Creates a questionnaire for ACH transfers. This may be used for compliance or setup purposes. ```APIDOC ## TransferQuestionnaireCreate ### Description Create questionnaire. ### Method POST ### Endpoint /transfer/questionnaire/create ### Request Body - **TransferQuestionnaireCreateRequest** (object) - Required - Request object to create a transfer questionnaire. ``` -------------------------------- ### CreditSessionsGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Retrieve credit sessions. Use this endpoint to get information about credit-related sessions. ```APIDOC ## CreditSessionsGet ### Description Retrieve credit sessions. Use this endpoint to get information about credit-related sessions. ### Method POST ### Endpoint /credit/sessions/get ### Request Body - **CreditSessionsGetRequest** (object) - Required - The request body for retrieving credit sessions. ### Response #### Success Response (200) - **CreditSessionsGetResponse** (object) - The response object containing credit session details. ``` -------------------------------- ### Initialize Plaid Client (New Way) Source: https://github.com/plaid/plaid-go/blob/master/README.md Initializes the Plaid client using a configuration object and environment settings. This is the recommended approach. ```go import ( "github.com/plaid/plaid-go/plaid" ) configuration := plaid.NewConfiguration() configuration.AddDefaultHeader("PLAID-CLIENT-ID", os.Getenv("CLIENT_ID")) configuration.AddDefaultHeader("PLAID-SECRET", os.Getenv("SECRET")) configuration.UseEnvironment(plaid.Sandbox) client := plaid.NewAPIClient(configuration) ``` -------------------------------- ### UserAccountSessionGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Retrieves an account session for a user. Use this endpoint to get details about a user's session. ```APIDOC ## UserAccountSessionGet ### Description Get account session for a user. ### Method POST ### Endpoint /user/account_session/get ### Request Body - **request** (UserAccountSessionGetRequest) - Required - The request object containing session retrieval details. ``` -------------------------------- ### CreditBankStatementsUploadsGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Retrieve bank statements uploads. Use this endpoint to get information about uploaded bank statements. ```APIDOC ## CreditBankStatementsUploadsGet ### Description Retrieve bank statements uploads. Use this endpoint to get information about uploaded bank statements. ### Method POST ### Endpoint /credit/bank_statements/uploads/get ### Request Body - **CreditBankStatementsUploadsGetRequest** (object) - Required - The request body for retrieving bank statements uploads. ### Response #### Success Response (200) - **CreditBankStatementsUploadsGetResponse** (object) - The response object containing details of uploaded bank statements. ``` -------------------------------- ### Initialize Plaid Go Client Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/configuration.md Create a new Configuration object, set client ID and secret, and specify the environment. Then, create a new API client. ```go configuration := plaid.NewConfiguration() configuration.AddDefaultHeader("PLAID-CLIENT-ID", "your_client_id") configuration.AddDefaultHeader("PLAID-SECRET", "your_secret") configuration.UseEnvironment(plaid.Production) client := plaid.NewAPIClient(configuration) ``` -------------------------------- ### AssetReportPdfGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Get an asset report in PDF format. This endpoint retrieves a PDF version of the asset report. ```APIDOC ## AssetReportPdfGet ### Description Get an asset report in PDF format. This endpoint retrieves a PDF version of the asset report. ### Method POST ### Endpoint /asset_report/pdf/get ### Request Body - **AssetReportPdfGetRequest** (object) - Required - The request body for retrieving the asset report PDF. ### Response #### Success Response (200) - **os.File** - The asset report as a PDF file. ``` -------------------------------- ### Set API Keys via Context Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/configuration.md Demonstrates how to set API keys (client ID, secret, Plaid version) using context values for authentication. ```go ctx := context.Background() apiKeys := map[string]plaid.APIKey{ "clientId": {Key: "your_client_id"}, "secret": {Key: "your_secret"}, "plaidVersion": {Key: "2020-09-14"}, } ctx = context.WithValue(ctx, plaid.ContextAPIKeys, apiKeys) ``` -------------------------------- ### AssetReportGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Retrieve an asset report. Use this endpoint to get the details of a previously created asset report. ```APIDOC ## AssetReportGet ### Description Retrieve an asset report. Use this endpoint to get the details of a previously created asset report. ### Method POST ### Endpoint /asset_report/get ### Request Body - **AssetReportGetRequest** (object) - Required - The request body for retrieving an asset report. ### Response #### Success Response (200) - **AssetReportGetResponse** (object) - The response object containing the asset report details. ``` -------------------------------- ### Initialize Plaid Client (Old Way) Source: https://github.com/plaid/plaid-go/blob/master/README.md Initializes the Plaid client using direct options. This method is deprecated. ```go import ( "github.com/plaid/plaid-go/plaid" ) client, err := plaid.NewClient(plaid.ClientOptions{ os.Getenv("PLAID_CLIENT_ID"), os.Getenv("PLAID_SECRET"), plaid.Sandbox, }) ``` -------------------------------- ### CreditPayrollIncomeGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Retrieve payroll income information. Use this endpoint to get details about a user's payroll income. ```APIDOC ## CreditPayrollIncomeGet ### Description Retrieve payroll income information. Use this endpoint to get details about a user's payroll income. ### Method POST ### Endpoint /credit/payroll_income/get ### Request Body - **CreditPayrollIncomeGetRequest** (object) - Required - The request body for retrieving payroll income. ### Response #### Success Response (200) - **CreditPayrollIncomeGetResponse** (object) - The response object containing payroll income details. ``` -------------------------------- ### CreditBankIncomeGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Retrieve bank income information. Use this endpoint to get details about a user's bank income. ```APIDOC ## CreditBankIncomeGet ### Description Retrieve bank income information. Use this endpoint to get details about a user's bank income. ### Method POST ### Endpoint /credit/bank_income/get ### Request Body - **CreditBankIncomeGetRequest** (object) - Required - The request body for retrieving bank income. ### Response #### Success Response (200) - **CreditBankIncomeGetResponse** (object) - The response object containing bank income details. ``` -------------------------------- ### Using a Custom HTTP Client Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/client.md Shows how to integrate a custom http.Client with the Plaid configuration for advanced use cases like logging or proxying. ```go configuration := plaid.NewConfiguration() configuration.HTTPClient = &http.Client{ Timeout: 30 * time.Second, Transport: &http.Transport{ MaxIdleConns: 100, }, } client := plaid.NewAPIClient(configuration) ``` -------------------------------- ### InstitutionsGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Get a list of financial institutions with pagination. This endpoint retrieves a paginated list of all available financial institutions. ```APIDOC ## InstitutionsGet ### Description Get a list of financial institutions with pagination. This endpoint retrieves a paginated list of all available financial institutions. ### Method `InstitutionsGet` ### Request `InstitutionsGetRequest` ### Response `InstitutionsGetResponse` ``` -------------------------------- ### Create Plaid API Client Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/configuration.md Instantiate a new API client with a configuration object. The client is used to interact with Plaid API services. ```go func NewAPIClient(cfg *Configuration) *APIClient ``` -------------------------------- ### Initiate a Transfer Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/quick-start.md Create and execute a request to initiate a transfer between accounts. Ensure you have the necessary access token and account details. ```go request := plaid.NewTransferCreateRequest( "access_token", "account_id", "checking", "iso20022", "OWNAC", "SAVAC", plaid.PtrString("Authorization Token"), plaid.PtrString("User Full Name"), ) request.SetAmount("12.34") request.SetDescription("Monthly rent") response, _, err := client.PlaidApi.TransferCreate(ctx). TransferCreateRequest(*request). Execute() if err == nil { fmt.Println("Transfer ID:", response.GetTransferId()) } ``` -------------------------------- ### IdentityVerificationGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Get details of an identity verification. This endpoint retrieves the status and details of a previously created identity verification. ```APIDOC ## IdentityVerificationGet ### Description Get details of an identity verification. This endpoint retrieves the status and details of a previously created identity verification. ### Method `IdentityVerificationGet` ### Request `IdentityVerificationGetRequest` ### Response `IdentityVerificationGetResponse` ``` -------------------------------- ### Plaid Environments Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/README.md Select between Plaid's production and sandbox environments. The sandbox environment is recommended for development and testing. ```go plaid.Production // https://production.plaid.com plaid.Sandbox // https://sandbox.plaid.com ``` -------------------------------- ### TransactionsRecurringGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Get recurring transactions for an Item. This endpoint identifies and retrieves recurring transactions, such as subscriptions or regular payments. ```APIDOC ## TransactionsRecurringGet ### Description Get recurring transactions for an Item. This endpoint identifies and retrieves recurring transactions, such as subscriptions or regular payments. ### Method `TransactionsRecurringGet` ### Request `TransactionsRecurringGetRequest` ### Response `TransactionsRecurringGetResponse` ``` -------------------------------- ### PaymentInitiationConsentCreate Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Create a payment initiation consent. This endpoint allows users to grant consent for payment initiation. ```APIDOC ## PaymentInitiationConsentCreate ### Description Create a payment initiation consent. This endpoint allows users to grant consent for payment initiation. ### Method POST ### Endpoint /payment_initiation/consent/create ### Request Body - **PaymentInitiationConsentCreateRequest** (object) - Required - The request body for creating consent. ### Response #### Success Response (200) - **PaymentInitiationConsentCreateResponse** (object) - The response object for the created consent. ``` -------------------------------- ### Item Management Endpoints Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/client.md Endpoints for managing Items, including getting status, removing, and handling token exchanges. ```APIDOC ## Item Management Endpoints ### Description This section details the API endpoints available for managing Items within the Plaid system. These operations allow you to retrieve Item status, remove Items, and manage access and public tokens. ### Endpoints - **`ItemGet`**: Retrieves the status and details of an Item. - **`ItemRemove`**: Removes an Item from Plaid. - **`ItemPublicTokenExchange`**: Exchanges a public token for an access token. - **`ItemCreatePublicToken`**: Creates a public token for sharing Item data. - **`ItemAccessTokenInvalidate`**: Invalidates an existing access token. - **`ItemWebhookUpdate`**: Updates the webhook URL associated with an Item. - **`ItemProductsTerminate`**: Terminates specific products for an Item. - **`ItemGet`**: Retrieves detailed information and error status for an Item. ``` -------------------------------- ### Set Plaid API Environment Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/configuration.md Configure the client to use either the Production or Sandbox environment for API requests. ```go configuration.UseEnvironment(plaid.Production) // or for testing configuration.UseEnvironment(plaid.Sandbox) ``` -------------------------------- ### CreditBankIncomePdfGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Get bank income information in PDF format. This endpoint retrieves a PDF version of the bank income report. ```APIDOC ## CreditBankIncomePdfGet ### Description Get bank income information in PDF format. This endpoint retrieves a PDF version of the bank income report. ### Method POST ### Endpoint /credit/bank_income/pdf/get ### Request Body - **CreditBankIncomePdfGetRequest** (object) - Required - The request body for retrieving the bank income PDF. ### Response #### Success Response (200) - **os.File** - The bank income information as a PDF file. ``` -------------------------------- ### CreditRelayPdfGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Get a credit relay report in PDF format. This endpoint retrieves a PDF version of the credit relay report. ```APIDOC ## CreditRelayPdfGet ### Description Get a credit relay report in PDF format. This endpoint retrieves a PDF version of the credit relay report. ### Method POST ### Endpoint /credit/relay/pdf/get ### Request Body - **CreditRelayPdfGetRequest** (object) - Required - The request body for retrieving the credit relay PDF. ### Response #### Success Response (200) - **os.File** - The credit relay report as a PDF file. ``` -------------------------------- ### Setting Request Options Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/types.md Demonstrates how to set optional parameters for an API request using the `SetOptions()` method and a dedicated options struct. This pattern is common across many Plaid SDK endpoints. ```go request := plaid.NewTransactionsGetRequest(accessToken, startDate, endDate) request.SetOptions(plaid.TransactionsGetRequestOptions{ Count: plaid.PtrInt32(50), Offset: plaid.PtrInt32(100), }) ``` -------------------------------- ### CreditRelayGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Retrieve a credit relay report. Use this endpoint to get the details of a previously created credit relay report. ```APIDOC ## CreditRelayGet ### Description Retrieve a credit relay report. Use this endpoint to get the details of a previously created credit relay report. ### Method POST ### Endpoint /credit/relay/get ### Request Body - **CreditRelayGetRequest** (object) - Required - The request body for retrieving a credit relay report. ### Response #### Success Response (200) - **CreditRelayGetResponse** (object) - The response object containing the credit relay report details. ``` -------------------------------- ### AssetReportAuditCopyPdfGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Get an audit copy of an asset report in PDF format. This endpoint retrieves a PDF version of the audit copy. ```APIDOC ## AssetReportAuditCopyPdfGet ### Description Get an audit copy of an asset report in PDF format. This endpoint retrieves a PDF version of the audit copy. ### Method POST ### Endpoint /asset_report/audit_copy/pdf/get ### Request Body - **AssetReportAuditCopyPdfGetRequest** (object) - Required - The request body for retrieving the audit copy PDF. ### Response #### Success Response (200) - **os.File** - The audit copy as a PDF file. ``` -------------------------------- ### Override Server URL using Context Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/configuration.md Shows how to specify a server index via context to override the default server URL for API operations. ```go ctx := context.Background() ctx = context.WithValue(ctx, plaid.ContextServerIndex, 1) // Use second server client.PlaidApi.SomeEndpoint(ctx).Execute() ``` -------------------------------- ### AssetReportAuditCopyGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Retrieve an audit copy of an asset report. Use this endpoint to get details of a previously created audit copy. ```APIDOC ## AssetReportAuditCopyGet ### Description Retrieve an audit copy of an asset report. Use this endpoint to get details of a previously created audit copy. ### Method POST ### Endpoint /asset_report/audit_copy/get ### Request Body - **AssetReportAuditCopyGetRequest** (object) - Required - The request body for retrieving an audit copy. ### Response #### Success Response (200) - **AssetReportAuditCopyGetResponse** (object) - The response object containing audit copy details. ``` -------------------------------- ### PaymentInitiationPaymentCreate Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Create a payment initiation payment. This endpoint initiates a payment transaction through the Payment Initiation service. ```APIDOC ## PaymentInitiationPaymentCreate ### Description Create a payment initiation payment. This endpoint initiates a payment transaction through the Payment Initiation service. ### Method POST ### Endpoint /payment_initiation/payment/create ### Request Body - **PaymentInitiationPaymentCreateRequest** (object) - Required - The request body for creating a payment. ### Response #### Success Response (200) - **PaymentInitiationPaymentCreateResponse** (object) - The response object for creating a payment. ``` -------------------------------- ### Run a Single Test in plaid-go Source: https://github.com/plaid/plaid-go/blob/master/CONTRIBUTING.md Use this command to execute a specific test within the plaid-go library. Ensure you set the CLIENT_ID and SECRET environment variables. ```shell CLIENT_ID="" SECRET="" go test -v ./... -run TESTNAME ``` -------------------------------- ### ProcessorIdentityGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Get identity information via a processor token. This endpoint retrieves identity data using a processor token. ```APIDOC ## ProcessorIdentityGet ### Description Get identity information via a processor token. This endpoint retrieves identity data using a processor token. ### Method `ProcessorIdentityGet` ### Request `ProcessorIdentityGetRequest` ### Response `ProcessorIdentityGetResponse` ``` -------------------------------- ### IdentityGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Get identity information for an Item. This endpoint retrieves identity data such as name, address, and email associated with an Item. ```APIDOC ## IdentityGet ### Description Get identity information for an Item. This endpoint retrieves identity data such as name, address, and email associated with an Item. ### Method `IdentityGet` ### Request `IdentityGetRequest` ### Response `IdentityGetResponse` ``` -------------------------------- ### ProcessorTransactionsRecurringGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Get recurring transactions via a processor token. This endpoint retrieves recurring transactions using a processor token. ```APIDOC ## ProcessorTransactionsRecurringGet ### Description Get recurring transactions via a processor token. This endpoint retrieves recurring transactions using a processor token. ### Method `ProcessorTransactionsRecurringGet` ### Request `ProcessorTransactionsRecurringGetRequest` ### Response `ProcessorTransactionsRecurringGetResponse` ``` -------------------------------- ### Using context.Context for Request Lifecycle Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/client.md Shows how to pass a context.Context to API methods for controlling request lifecycle, including setting timeouts. ```go ctx := context.Background() // With timeout ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) def cancel() response, _, err := client.PlaidApi.AccountsGet(ctx).AccountsGetRequest(*request).Execute() ``` -------------------------------- ### TransactionsUserInsightsGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Get user transaction insights. This endpoint provides insights into a user's spending habits and transaction patterns. ```APIDOC ## TransactionsUserInsightsGet ### Description Get user transaction insights. This endpoint provides insights into a user's spending habits and transaction patterns. ### Method `TransactionsUserInsightsGet` ### Request `TransactionsUserInsightsGetRequest` ### Response `TransactionsUserInsightsGetResponse` ``` -------------------------------- ### Configure Plaid Environment Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/quick-start.md Set the Plaid API environment (Production or Sandbox) based on an environment variable. Use Sandbox for development and testing. ```go env := os.Getenv("APP_ENV") if env == "production" { configuration.UseEnvironment(plaid.Production) } else { configuration.UseEnvironment(plaid.Sandbox) } ``` -------------------------------- ### AccountsBalanceGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Get real-time account balances for an Item. This endpoint returns the current and available balance for each account associated with an Item. ```APIDOC ## AccountsBalanceGet ### Description Get real-time account balances for an Item. This endpoint returns the current and available balance for each account associated with an Item. ### Method `AccountsBalanceGet` ### Request `AccountsBalanceGetRequest` ### Response `AccountsGetResponse` ``` -------------------------------- ### InstitutionsGetById Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Get a single financial institution by ID. This endpoint retrieves details for a specific financial institution using its unique ID. ```APIDOC ## InstitutionsGetById ### Description Get a single financial institution by ID. This endpoint retrieves details for a specific financial institution using its unique ID. ### Method `InstitutionsGetById` ### Request `InstitutionsGetByIdRequest` ### Response `InstitutionsGetByIdResponse` ``` -------------------------------- ### Create Link Token Request Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/key-endpoints.md Use this to initialize Plaid Link in your application. It requires client name, language, country codes, and user information. You can also specify products, webhooks, and account filters. ```go func (a *PlaidApiService) LinkTokenCreate(ctx _context.Context) ApiLinkTokenCreateRequest type LinkTokenCreateRequest struct { ClientName string // Required Language string // Required CountryCodes []CountryCode // Required User LinkTokenCreateRequestUser // Required ClientUserId *string RedirectUri *string Products []Products Webhook *string AccountFilters *LinkTokenAccountFilters AndroidPackageName *string AppPackageName *string Institutions *[]string LinkCustomizationName *string AuthInitiatedFromMobile *bool IncludePaymentInitiation *bool } type LinkTokenCreateResponse struct { LinkToken string Expiration string // ISO8601 datetime RequestId string } ``` -------------------------------- ### ProcessorTransactionsGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Get transactions via a processor token. This endpoint retrieves transactions using a processor token instead of an Item ID. ```APIDOC ## ProcessorTransactionsGet ### Description Get transactions via a processor token. This endpoint retrieves transactions using a processor token instead of an Item ID. ### Method `ProcessorTransactionsGet` ### Request `ProcessorTransactionsGetRequest` ### Response `ProcessorTransactionsGetResponse` ``` -------------------------------- ### PaymentInitiationPaymentList Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md List all payment initiation payments. This endpoint retrieves a list of all payments associated with the account. ```APIDOC ## PaymentInitiationPaymentList ### Description List all payment initiation payments. This endpoint retrieves a list of all payments associated with the account. ### Method POST ### Endpoint /payment_initiation/payment/list ### Request Body - **PaymentInitiationPaymentListRequest** (object) - Required - The request body for listing payments. ### Response #### Success Response (200) - **PaymentInitiationPaymentListResponse** (object) - The response object containing a list of payments. ``` -------------------------------- ### NewConfiguration Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/configuration.md Creates a new Configuration object with default settings. This includes default Plaid API version, user agent, and server environments. It can be further customized by adding default headers and selecting a specific environment. ```APIDOC ## NewConfiguration ### Description Creates a new Configuration object with default settings. The configuration includes: - Default Plaid API version header: `2020-09-14` - User agent: `Plaid Go v42.2.0` - Two default servers: Production and Sandbox environments - Empty default headers (except Plaid-Version) ### Returns `*Configuration` — A new Configuration struct ready for customization. ### Example ```go configuration := plaid.NewConfiguration() configuration.AddDefaultHeader("PLAID-CLIENT-ID", "your_client_id") configuration.AddDefaultHeader("PLAID-SECRET", "your_secret") configuration.UseEnvironment(plaid.Production) client := plaid.NewAPIClient(configuration) ``` ``` -------------------------------- ### ProcessorAuthGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Get authentication details via a processor token. This endpoint retrieves account and routing numbers using a processor token. ```APIDOC ## ProcessorAuthGet ### Description Get authentication details via a processor token. This endpoint retrieves account and routing numbers using a processor token. ### Method `ProcessorAuthGet` ### Request `ProcessorAuthGetRequest` ### Response `ProcessorAuthGetResponse` ``` -------------------------------- ### Environments Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/README.md Available Plaid API environments for production and sandbox. ```APIDOC ## Environments ### Description Plaid offers two production environments: - `plaid.Production`: For live API calls (`https://production.plaid.com`). - `plaid.Sandbox`: For development and testing (`https://sandbox.plaid.com`). ### Example ```go // Use plaid.Production or plaid.Sandbox ``` ``` -------------------------------- ### PaymentInitiationRecipientList Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md List all payment initiation recipients. This endpoint retrieves a list of all recipients configured for payment initiation. ```APIDOC ## PaymentInitiationRecipientList ### Description List all payment initiation recipients. This endpoint retrieves a list of all recipients configured for payment initiation. ### Method POST ### Endpoint /payment_initiation/recipient/list ### Request Body - **PaymentInitiationRecipientListRequest** (object) - Required - The request body for listing recipients. ### Response #### Success Response (200) - **PaymentInitiationRecipientListResponse** (object) - The response object containing a list of recipients. ``` -------------------------------- ### Get Identity Information Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/quick-start.md Retrieve identity details such as names, email addresses, and physical addresses for an account. Ensure you have the necessary access token. ```go request := plaid.NewIdentityGetRequest("access_token") response, _, err := client.PlaidApi.IdentityGet(ctx). IdentityGetRequest(*request). Execute() if err == nil { for _, account := range response.GetAccounts() { identity := account.GetIdentity() // Names for _, name := range identity.GetNames() { fmt.Println("Name:", name) } // Email addresses for _, email := range identity.GetEmails() { fmt.Println("Email:", email.GetData()) } // Addresses for _, addr := range identity.GetAddresses() { fmt.Printf("Address: %s, %s, %s\n", addr.GetStreet().Get(), addr.GetCity().Get(), addr.GetPostalCode().Get()) } } } ``` -------------------------------- ### SandboxItemApplicationSeed Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Seeds an application with Items in the sandbox environment. This is useful for setting up a sandbox environment with pre-populated data. ```APIDOC ## SandboxItemApplicationSeed ### Description Seed application with Items for sandbox environment. ### Method POST ### Endpoint /sandbox/item/application/seed ### Request Body - **client_id** (string) - Required - Your Plaid API client ID. - **secret** (string) - Required - Your Plaid API secret. - **products** (array of strings) - Required - The Plaid products to seed. - **webhook** (string) - Optional - The URL to which webhook events should be sent. ### Response #### Success Response (200) - **access_token** (string) - The access token for the seeded Item. - **item_id** (string) - The Item ID. - **request_id** (string) - A unique identifier for the request, which can be used for troubleshooting. ``` -------------------------------- ### Call SandboxPublicTokenCreate (Old Way) Source: https://github.com/plaid/plaid-go/blob/master/README.md Calls the SandboxPublicTokenCreate endpoint using the older client method signature. ```go response, err := client.CreateSandboxPublicToken(SandboxInstitution, TestProducts) ``` -------------------------------- ### ProcessorAccountGet Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/endpoints.md Get account details via a processor token. This endpoint is used to retrieve account information when you have a processor token instead of an Item ID. ```APIDOC ## ProcessorAccountGet ### Description Get account details via a processor token. This endpoint is used to retrieve account information when you have a processor token instead of an Item ID. ### Method `ProcessorAccountGet` ### Request `ProcessorAccountGetRequest` ### Response `ProcessorAccountGetResponse` ``` -------------------------------- ### Create Plaid Link Token Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/quick-start.md Create a Link Token to initialize Plaid Link in your frontend. This request requires an application name, language, country codes, and a user ID. You can also specify which products to enable. ```go user := plaid.LinkTokenCreateRequestUser{ ClientUserId: "user123", } request := plaid.NewLinkTokenCreateRequest( "My App", "en", []plaid.CountryCode{plaid.COUNTRYCODE_US}, user, ) request.SetProducts([]plaid.Products{plaid.PRODUCTS_AUTH, plaid.PRODUCTS_TRANSACTIONS}) response, _, err := client.PlaidApi.LinkTokenCreate(ctx). LinkTokenCreateRequest(*request). Execute() if err == nil { fmt.Println("Link Token:", response.GetLinkToken()) // Return linkToken to frontend for Plaid Link } ``` -------------------------------- ### Accessing HTTP Response Details Source: https://github.com/plaid/plaid-go/blob/master/_autodocs/api-reference/client.md Illustrates how to retrieve the HTTP response object from the Execute() method to access headers and status codes. ```go response, httpResponse, err := client.PlaidApi.AccountsGet(ctx). AccountsGetRequest(*request). Execute() if err == nil { fmt.Println("Status:", httpResponse.Status) fmt.Println("Headers:", httpResponse.Header) } ```