Import Invoices to Lawpractica

The Lawpractica Invoices Import API allows for the seamless importation of existing invoice data into Lawpractica. This functionality is designed specifically for developers looking to integrate or migrate invoice information into Lawpractica efficiently.
Authentication Method
The API uses a Bearer token (API Key) for authentication.
Obtaining Credentials
Credentials can be obtained from the Lawpractica application under the Integration tab in the Manage Settings form. Look for the Security Key value provided in the data exchange section.
Invoices Import Endpoint
  • URL:
  • Method: POST
  • Description: Imports invoice data into Lawpractica.
  • Request Headers:
    • Authorization: Bearer token (API key)
    • sd: Name of the user's subdomain (instance of the user application)
Request Body
Request body contains the requestor's information and an array of invoices to be imported.

Request body schema (JSON Schema)
{
    "UserPrefix": "string",
    "UserFullName": "string",
    "UserEmail": "string",
    "ProfileCode": "string",
    "IsSendNotification": "integer",
    "NotificationEmail": "string",
    "NotificationCustomMessage": "string",
    "Invoices": [
    {   
        "InvoiceDate": "DateTime",
        "InvoiceFileNumber": "string",
        "InvoiceReferenceNo": "string",
        "FeesDescription": "string",
        "FeesAmount": "decimal?",
        "ExpenseDescription": "string",
        "ExpenseAmount": "decimal",
        "Discount": "decimal",
        "SubTotal": "decimal",
        "Tax1Amount": "decimal",
        "Tax2Amount": "decimal",
        "InvoiceTotalAmount": "decimal",
        "ExpenseInvoiceRefNo": "string",
        "InvoiceUI": "string",
        "InvoiceUpdDate": "DateTime"
    }
  ]
}
    
Response Body
Response body contains a summary of the import operation and details of each invoice processed.
  • Description:   A summary of the import operation, including the Import Request ID and the number of invoices successfully imported.
    TotalRecords: Total number of invoice records processed.
    TotalInserted: Number of new invoice records inserted during the import.
    TotalUpdated: Number of invoice records updated during the import.
    TotalErrors:    Number of errors encountered during the import process.
    Invoices:         An array containing details of each invoice processed.
    • id: Unique identifier of the invoice record.
      >Other invoice attributes.

      >importNotes: Descriptions of any errors encountered while importing the invoice data.
      >importStatus: Indicates the status of the import operation for the invoice record. It has the format "I-[id]" if the record was inserted, "U-[id]" if it was updated, where "id" is the record ID.


  • Response body schema (JSON Schema)
    {
        "RequestID": "integer",
        "TotalRecords": "integer",
        "TotalUpdated": "integer",
        "TotalInserted": "integer",
        "TotalErrors": "integer",
        "Invoices": [
        {
            "ID": "string",
            "InvoiceDate": "DateTime",
            "InvoiceFileNumber": "string",
            "InvoiceReferenceNo": "string",
            "FeesDescription": "string",
            "FeesAmount": "decimal?",
            "ExpenseDescription": "string",
            "ExpenseAmount": "decimal",
            "Discount": "decimal",
            "SubTotal": "decimal",
            "Tax1Amount": "decimal",
            "Tax2Amount": "decimal",
            "InvoiceTotalAmount": "decimal",
            "ExpenseInvoiceRefNo": "string",
            "InvoiceUI": "string",
            "InvoiceUpdDate": "DateTime",
            "ImportNotes": "string",
            "ImportStatus": "string"
        }
      ]
    }
    
    • 400 Invalid JSON Format: The provided JSON information is invalid.
    • 411 User information cannot be empty: User information required for the operation is missing.
    • 411 API Key cannot be empty: API key required for authentication is missing.
    • 411 Subdomain cannot be empty: Subdomain information required for the operation is missing.
    • 411 Notification email cannot be empty (if IsSendNotification = 1): Notification email is required when notification is enabled.
    • 422 Invalid notification email format (if IsSendNotification=1): The format of the notification email is invalid.
    • 422 Invalid token: The provided token is invalid.
    • 500 Exception: An internal server error occurred.

    
    
    
    
    

    
    
        crossDomain: true,
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        data: JSON.stringify(Invoices),
        headers: {
            'Authorization': 'Bearer ' + apiKey,
            'sd:' + subDomain,
            'Content-Type': 'application/json'
        }
    
    

    
    
        var Invoices =
        {
        "UserPrefix": "BS",
        "UserFullName": "Brian Smith",
        "UserEmail": "info@lawpractica.com",
        "ProfileCode": "LP-DE",
        "IsSendNotification": "0",
        "NotificationEmail": "notification@example.com",
        "NotificationCustomMessage": "This is a custom notification message",
        "Invoices": [
        {
        "InvoiceFileNumber": "INV-2024-001",
        "InvoiceDate": "2024-01-30",
        "InvoiceReferenceNo": "ABC123",
        "FeesDescription": "Legal services for client X",
        "FeesAmount": 1500.00,
        "ExpenseDescription": "Travel expenses",
        "ExpenseAmount": 200.00,
        "Discount": 0.00,
        "SubTotal": 1700.00,
        "Tax1Amount": 136.00,
        "Tax2Amount": 0.00,
        "InvoiceTotalAmount": 1836.00,
        "ExpenseInvoiceRefNo": "123",
        "InvoiceUI": "INV00001",
        "InvoiceUpdDate": "2024-01-30T15:00:00"
        },
        {
        "InvoiceFileNumber": "INV-2024-002",
        "InvoiceDate": "2024-02-02",
        "InvoiceReferenceNo": "DEF456",
        "FeesDescription": "Consulting services for client Y",
        "FeesAmount": 2500.00,
        "ExpenseDescription": "Office supplies",
        "ExpenseAmount": 50.00,
        "Discount": 100.00,
        "SubTotal": 2450.00,
        "Tax1Amount": 196.00,
        "Tax2Amount": 0.00,
        "InvoiceTotalAmount": 2646.00,
        "ExpenseInvoiceRefNo": "321",
        "InvoiceUI": "INV00002",
        "InvoiceUpdDate": "2024-01-31T15:00:00"
        }
        ]
        }
    
    

    
    
    200: function  () {
        console.log("200 - Success");
        },
    
    //when any of info not supplied (without json object(ajax) either in URL parameters)
    400: function (request, status, error) { alert(error); },
    //when any of supplied info is empty
    411: function (request, status, error) { alert(error); },
    //when the provided info is not invalid
    422: function (request, status, error) { alert(error); }, 500: function (request, status, error) { alert(error); }

    https://
    lawpractica.com