Skip to content
Get startedWebsite

Create account

client.Accounts.New(ctx, body) (*Account, error)
POST/api/v1/accounts

Create account

ParametersExpand Collapse
body AccountNewParams
AccountType param.Field[AccountNewParamsAccountType]
const AccountNewParamsAccountTypeChecking AccountNewParamsAccountType = "checking"
const AccountNewParamsAccountTypeSaving AccountNewParamsAccountType = "saving"
UserID param.Field[string]
formatuuid
Currency param.Field[string]Optional
Environment param.Field[string]Optional
OrganizationID param.Field[string]Optional
formatuuid
ReturnsExpand Collapse
type Account struct{…}
ID string
formatuuid
AccountNumber string
AccountType AccountAccountType
One of the following:
const AccountAccountTypeChecking AccountAccountType = "checking"
const AccountAccountTypeSaving AccountAccountType = "saving"
Balance string
Currency string
Environment string
Status AccountStatus
One of the following:
const AccountStatusActive AccountStatus = "active"
const AccountStatusSuspended AccountStatus = "suspended"
const AccountStatusClosed AccountStatus = "closed"
UserID string
formatuuid
AdminUserID stringOptional
formatuuid
CreatedAt TimeOptional
formatdate-time
OrganizationID stringOptional
formatuuid
UpdatedAt TimeOptional
formatdate-time
UserRole stringOptional

Create account

package main

import (
  "context"
  "fmt"

  "github.com/railsinfra/rails-go"
  "github.com/railsinfra/rails-go/option"
)

func main() {
  client := rails.NewClient(
    option.WithAPIKey("My API Key"),
  )
  account, err := client.Accounts.New(context.TODO(), rails.AccountNewParams{
    AccountType: rails.AccountNewParamsAccountTypeChecking,
    UserID: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", account.ID)
}
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "account_number": "account_number",
  "account_type": "checking",
  "balance": "balance",
  "currency": "currency",
  "environment": "environment",
  "status": "active",
  "user_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "admin_user_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "created_at": "2019-12-27T18:11:19.117Z",
  "organization_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "user_role": "user_role"
}
Returns Examples
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "account_number": "account_number",
  "account_type": "checking",
  "balance": "balance",
  "currency": "currency",
  "environment": "environment",
  "status": "active",
  "user_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "admin_user_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "created_at": "2019-12-27T18:11:19.117Z",
  "organization_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "user_role": "user_role"
}