# Create loan tape type

Creates a new loan tape type.

Endpoint: POST /companies/{companyId}/loan-tape-types
Version: 2023-11-29
Security: oauth2, bearerAuth, apiKeyHeader

## Path parameters:

  - `companyId` (string, required)
    The unique company identifier.

## Request fields (application/json):

  - `actionOnMissingData` (string)
    Due to various circumstances, it is possible that not all data needed to produce a given loan tape
will be available at the time of tape generation.

In this situation, there are two options for how these records will be represented in a tape:

- includeIDsAndEmptyData (recommended) - The tape will include records that have missing data
  (only reportDate, loanId, mainBorrowerId, mainBorrowerExternalId, loanExternalId,
  and dataStatus columns will be populated, assuming they are configured).

- excludeFromTape - Records with missing data will be dropped completely from the tape.
  By choosing excludeFromTape lenders will be responsible for validating number of loans included within tapes.
    Enum: "includeIDsAndEmptyData", "excludeFromTape"

  - `compressionType` (string)
    Compression type used for result file.
    Enum: "noCompression", "gzip", "zip"

  - `fieldNameMappings` (object)
    Mapping of fields from fields to field names used in the bank/investor's system.

For example: {"investorId": "investor_id", "isChargedOff": "loan_charged_off"}

  - `fields` (any, required)
    A list of fields to be included in a specific tape. There are two tapeType available - loans and payments.
When you choose a list of fields, make sure to include only the values corresponding to tapeType.
For example: tapeType=loans cannot have an attribute paymentMethodType because that field is only relevant to tapeType=payments.

loanMetaData - is a special field. If included, the caller must provide the loanMetaDataFields attribute.

mainBorrowerIdentityValue - is the borrower's identity number such as SSN, ITIN, tax ID, FEIN, etc.
This value is encrypted in Peach system. If you want to export that value in loan tapes, you must have encryptionMethod
and publicKey set when you call "Create loan tape". In other words, loan tape must be encrypted in order to
populate mainBorrowerIdentityValue.

  - `loanMetaDataFields` (array)
    A list of loan's metaData keys/values to be included in a specific tape.
Loan's metaData attribute consists of key/value pairs in the form of a JSON dictionary.
The loanMetaDataFields value must be provided if loanMetaData is included in the fields list.
If the key cannot be found in the loan's metaData attribute, the tape will populate the column name
(aka key) but will not populate the value (aka the value will be empty).
If found, each column name will be the "key" + "LoanMetaData" and the value will be the "value".
The search/look up of the loanMetaDataFields key in the loan's metaData attribute is case-sensitive.
Peach doesn't know what data is provided in the loan's metaData attribute, and we don't check validity of the key/value pairs.
It's lender/caller responsibility to make sure that the loan's metaData attribute has valid and formatted values.

  - `moneyUnit` (string)
    If subUnit100, the amount fields in loan tapes will be in pennies. For example: 100 means $1.00 (one dollar).

If fullUnit, the amount fields in loan tapes will be in decimal format with 2 places after the decimal point.
For example: 32.45 is thirty-two dollars and forty-five cents.
    Enum: "fullUnit", "subUnit100"

  - `reportDaysWhenPaidOff` (integer)
    Number of days to report a loan after it was changed to paidOff.
Make sure you check that your loan types are configured to generate snapshots for number of days that is greater than reportDaysWhenPaidOff for loans that are in paidOff status.
If your company has many loan types, please check them all.
Loans without snapshots data cannot be reported in the loan tape

  - `shouldReportDrawsSeparately` (boolean)
    Indicates whether LOC Draws should be reported as separate rows in loan tape. LOC will always be reported on an aggregated level.

  - `tapeName` (string, required)
    A friendly name for the tape.

  - `tapeOutputFormat` (string)
    The tape output format.
    Enum: "CSV"

  - `tapeType` (string, required)
    The loan tape type.

loans - the tape includes information about accounts (e.g. loans).

payments - the tape includes information about payments made by borrowers.
    Enum: "loans", "payments"

## Response 200 fields (application/json):

  - `message` (string)
    Description of the server action or error.

  - `status` (integer)
    HTTP status code.

  - `data` (object)

  - `data.createdAt` (string)

  - `data.deletedAt` (string,null)

  - `data.id` (string)

  - `data.updatedAt` (string,null)

  - `data.actionOnMissingData` (string)
    Due to various circumstances, it is possible that not all data needed to produce a given loan tape
will be available at the time of tape generation.

In this situation, there are two options for how these records will be represented in a tape:

- includeIDsAndEmptyData (recommended) - The tape will include records that have missing data
  (only reportDate, loanId, mainBorrowerId, mainBorrowerExternalId, loanExternalId,
  and dataStatus columns will be populated, assuming they are configured).

- excludeFromTape - Records with missing data will be dropped completely from the tape.
  By choosing excludeFromTape lenders will be responsible for validating number of loans included within tapes.
    Enum: "includeIDsAndEmptyData", "excludeFromTape"

  - `data.compressionType` (string)
    Compression type used for result file.
    Enum: "noCompression", "gzip", "zip"

  - `data.fieldNameMappings` (object)
    Mapping of fields from fields to field names used in the bank/investor's system.

For example: {"investorId": "investor_id", "isChargedOff": "loan_charged_off"}

  - `data.fields` (any)
    A list of fields to be included in a specific tape. There are two tapeType available - loans and payments.
When you choose a list of fields, make sure to include only the values corresponding to tapeType.
For example: tapeType=loans cannot have an attribute paymentMethodType because that field is only relevant to tapeType=payments.

loanMetaData - is a special field. If included, the caller must provide the loanMetaDataFields attribute.

mainBorrowerIdentityValue - is the borrower's identity number such as SSN, ITIN, tax ID, FEIN, etc.
This value is encrypted in Peach system. If you want to export that value in loan tapes, you must have encryptionMethod
and publicKey set when you call "Create loan tape". In other words, loan tape must be encrypted in order to
populate mainBorrowerIdentityValue.

  - `data.loanMetaDataFields` (array)
    A list of loan's metaData keys/values to be included in a specific tape.
Loan's metaData attribute consists of key/value pairs in the form of a JSON dictionary.
The loanMetaDataFields value must be provided if loanMetaData is included in the fields list.
If the key cannot be found in the loan's metaData attribute, the tape will populate the column name
(aka key) but will not populate the value (aka the value will be empty).
If found, each column name will be the "key" + "LoanMetaData" and the value will be the "value".
The search/look up of the loanMetaDataFields key in the loan's metaData attribute is case-sensitive.
Peach doesn't know what data is provided in the loan's metaData attribute, and we don't check validity of the key/value pairs.
It's lender/caller responsibility to make sure that the loan's metaData attribute has valid and formatted values.

  - `data.moneyUnit` (string)
    If subUnit100, the amount fields in loan tapes will be in pennies. For example: 100 means $1.00 (one dollar).

If fullUnit, the amount fields in loan tapes will be in decimal format with 2 places after the decimal point.
For example: 32.45 is thirty-two dollars and forty-five cents.
    Enum: "fullUnit", "subUnit100"

  - `data.reportDaysWhenPaidOff` (integer)
    Number of days to report a loan after it was changed to paidOff.
Make sure you check that your loan types are configured to generate snapshots for number of days that is greater than reportDaysWhenPaidOff for loans that are in paidOff status.
If your company has many loan types, please check them all.
Loans without snapshots data cannot be reported in the loan tape

  - `data.shouldReportDrawsSeparately` (boolean)
    Indicates whether LOC Draws should be reported as separate rows in loan tape. LOC will always be reported on an aggregated level.

  - `data.tapeName` (string)
    A friendly name for the tape.

  - `data.tapeOutputFormat` (string)
    The tape output format.
    Enum: "CSV"

  - `data.tapeType` (string)
    The loan tape type.

loans - the tape includes information about accounts (e.g. loans).

payments - the tape includes information about payments made by borrowers.
    Enum: "loans", "payments"


