12.3. Common LibEuFin HTTP API Conventions

12.3.1. Contact details

type EmailAddress = string;
type PhoneNumber = string;

Phone numbers should start with the + symbol and the country code.

12.3.2. Ratios and Fees

type LibeufinNumber = number;

Note: this quantity is normally enforced to have at most two decimal digits. The reason is to preserve the 2-decimal digits policy of the Amount type, as LibeufinNumber is used to multiply Amount.

12.3.3. Amounts

type Amount = string;

Amounts have the $currency:X.Y format, where the fractional part is optional and may contain at most two digits.

12.3.4. Permissions

This type epresses which permissions for a subject apply on a resource.

interface LibeufinPermission {
  subjectType: string;
  subjectId: string;
  resourceType: string;
  resourceId: string;
  permissionName: string
}

12.3.5. Fetch params

interface FetchParams {

  // Because transactions are delivered by banks in "batches",
  // then every batch can have different qualities.  This value
  // lets the request specify which type of batch ought to be
  // returned.  Currently, the following two type are supported:
  //
  // 'report': typically includes only non booked transactions.
  // 'statement': typically includes only booked transactions.
  level: "report" | "statement" | "all";

  // This type indicates the time range of the query.
  // It allows the following values:
  //
  // 'latest': retrieves the last transactions from the bank.
  //           If there are older unread transactions, those will *not*
  //           be downloaded.
  //
  // 'all': retrieves all the transactions from the bank,
  //        until the oldest.
  //
  // 'previous-days': currently *not* implemented, it will allow
  //                  the request to download transactions from
  //                  today until N days before.
  //
  // 'since-last': retrieves all the transactions since the last
  //               time one was downloaded.
  //
  rangeType: "latest" | "all" | "previous-days" | "since-last";
};