Elven Docs
English
English
  • Getting Started
  • System Configuration
    • Getting started with Elven
    • Project and Entities
      • Choose an Accounting Start Date
    • Inviting team members
    • Viewing activity logs
  • Financial Configuration
    • Configure Chart of Accounts
    • Configure Journal types
    • Configure Auxiliary Accounting
    • Setting Account Opening Balance
  • ACOUNT MANAGEMENT
    • Importing account balances
    • Importing transactions
      • Importing derivatives transactions
    • Verifying account balances
    • Counterparty Accounts Management
      • Managing counterparties
      • Automated counterparty identification
  • Transactions management
    • Transactions overview
  • Bookkeeping
    • Accounting with transaction data
      • Tagging of transactions
      • Rule based tagging
    • Accounting with business data
      • Importing business data using API
      • Importing business data with CSV file
      • Automated bookkeeping of business data
  • ASSETS AND VALUATIONS
    • Assets management
      • Add tokens via smart contract
      • Customising price feeds for assets
    • Fair value of Crypto assets and adjustments
    • Currency exchange (FX) PnL adjustment
    • Derivatives unrealized PnL adjustment
    • Broker business inventory management
  • RECONCILIATION
    • Transaction Reconciliation
  • REPORTS
    • Trial balance
    • Account Balance sheet
    • Financial statements
    • Crypto assets disclosure form
    • Dashboard
  • OpenAPI
    • Obtaining API Authorization
    • Import Business Data
    • Create Account
    • Query Account
    • Create Source
    • Query Source
    • Import Transfer
    • Import Trade
    • Import Gain/Loss
    • Import Account Balances
    • Import Price
    • Query Platform
    • Query Currency
    • Timezone
Powered by GitBook
On this page
  • Obtaining API authorization keys
  • Authenticating API endpoint
  • Uploading business data

Was this helpful?

  1. Bookkeeping
  2. Accounting with business data

Importing business data using API

PreviousAccounting with business dataNextImporting business data with CSV file

Last updated 7 months ago

Was this helpful?

Obtaining API authorization keys

Log into the Elven system, and navitage to the Entity for which you wish to integrate your business data using API. Click on the Ledger page, then locate an "Integrations" button at the upper right corner of your screen.

In the pop-up Integration management window, click on the "+Add new integration" button.

Set a desired label name for the new data type, and click the "Add" button.

Once the data type has been added, you can now add new data. Click the "Add data" button, and select "OpenAPI Integration" from the dropdown menu.

In the pop-up OpenAPI Integration window, click on the "Create" button.

In the next window, name the newly created API key.

Click on the "Create" button to finalize creation of the new API key.

You can click on the "Copy" icon next to each Key/Secret to copy it's content into your clipboard for use.

Authenticating API endpoint

Provide the following parameters in the Request header.

elven-api-key  The obtained apiKey
elven-api-sign  Signature in base64 format, e.g. LVT5aXA9064gpgZrPXPLJB/Aq9r45yMF10sTZQTteyE=
elven-api-timestamp Timestamp in milliseconds, e.g. 1721209655047, expiry is 30seconds

Generate the signature by concatenating the timestamp, request method, and path, then use the apisecret in a HMAC SHA256 encryption.

// crypto uses https://github.com/nodejs/node/blob/v16.9.0/lib/crypto.js εΊ“
  /**
   * Generate signature
   * apiSecret: BjGiqCWfHGCrl065dlEBWFO5vLj7Hqiexxx,
   * timestamp: 1721205912758
   * method POST
   *  path  /open/v3/businessData
   */
  buildSign(apiSecret: string, timestamp: number, method: string, path: string) {
    const str = `${timestamp}${method}${path}`
    return crypto.createHmac('sha256', apiSecret).update(str).digest('base64')
  }

Sample outcome:

[
  'D7JLJ3awwrTdNXtSrPI1GlYE', // key
  'BjGiqCWfHGCrl065dlEBWFO5vLj7Hqie', // secret
  'POST', // method in CAPS
  '/open/v3/businessData' // not including domain, only the path starting with /
]
{
  'elven-api-key': 'D7JLJ3awwrTdNXtSrPI1GlYE',
  'elven-api-sign': 'LVT5aXA9064gpgZrPXPLJB/Aq9r45yMF10sTZQTteyE=',
  'elven-api-timestamp': 1721209655047
}

Uploading business data

POST https://openapi.elven.com/open/v3/businessData

header
{
  elven-api-key: aaaa
  elven-api-sign: bbbbbbbbbbbb
  elven-api-timestamp: 22222222
}

body
{
       businessDataTypeName: 'Settlement', // Data type that has been created
       businessDataSourceName: 'Settlement-2024-07',// For OpenAPI types that has not been created.
       businessDataList: [
               {"a": 100, "b": "buy", "c": "2024-07-01 22:33:44"},
               {"a": 100, "b": "sell", "c": "2024-07-01 23:33:44"},
               {"a": 100, "b": "buy", "c": "2024-07-02 06:33:44"},
       ]
}