Introduction

Welcome to the Masraff API! You can use our API to access masraff endpoints, which can get information on expense details.

If you have any questions please feel free to use

Authentication

Masraff uses API keys to allow access to the API. You can request for a new key by mailing info@masraff.co

Masraff expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: yourMasraffApiKey

To authorize, use this code:

# With shell, you can just pass the correct header with each request

curl "api_endpoint_here"

-H "Authorization: yourMasraffApiKey"

Expenses

Get Expenses Metadata For Company

This endpoint returns all untransferred expenses ids and count of company

This endpoint retrieves all unfetched expenses metada.



HTTP Request

GET api.masraff.co/v1/integration/metadata

curl "http://api.masraff.co/v1/integration/metadata"

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


{
     "expenses": [
         2,
         3,
         4,
         5,
         6
     ],
     "count": 5
 }




Get Expenses Metadata For SubCompany

This endpoint returns all untransferred expenses ids and count of subcompany

This endpoint retrieves all unfetched expenses metada.



HTTP Request

GET api.masraff.co/v1/integration/metadata/subcompany/subcompanyId


URL Parameters

Parameter Description
SubcompanyID The ID of subcompany in Masraff System

curl "http://api.masraff.co/v1/integration/metadata/subcompany/3"

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


                
 {
     "expenses": [
         12,
         23,
         44,
         65,
         86
     ],
     "count": 5
 }

 

Get a Specific Expense Details

This endpoint retrieves a specific expense that is not marked as transfered.



HTTP Request

GET api.masraff.co/v1/integration/expense/Id


URL Parameters

Parameter Description
Id The ID of expense retrieved from metadata

curl "http://api.masraff.co/v1/integration/expense/id"

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:

                
 {
     "Id: 665, Id of expense in Masraff system
     "UserId": 5, Id of User in Masraff system
     "ReportId": 195, Id of report in Masraff system
     "CompanyId": 1, Id of company in Masraff system, not subcompany
     "CurrencyType": "TL", Id of report in Masraff system
     "ExpenseDate": "20171026",
     "CreateDate": "20171025",
     "Amount": 200,
     "TaxPercentage": 18,
     "TaxPercentageCode": "V1", Integration code for Tax Percentage
     "PersonnelCode": "P00023",
     "SubcompanyId": 1, Id of subcompany in Masraff system. If none returns null
     "SubcompanyCode": "AA-123",
     "TaxAmount": 30.51, 
     "ExpenseTypeId": 3, category id of expense
     "IntegrationCode": "OTL123A", Integration code of expense type
     "Note": "notes-on-expense",
     "ImageURL": "url-for-image-file",
     "Merchant": "XX RESTAURANT",
     "AccountCode": "12.511.12",
     "TaxAccountCode": "",
     "UserOHPCode": "AAA",
     "UserArpCode": "12.123.1234",
     "TagName": "İş Yemeği"
}


Mark a Specific Expense Transfered

This endpoint marks a specific expense transfered.



HTTP Request

POST api.masraff.co/v1/integration/expense/id/transfer


URL Parameters

Parameter Description
Id The ID of expense that is going to be marked

curl "http://api.masraff.co/v1/integration/expense/id/transfer"

-X POST

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:

                                     
 {
    "success": true
}