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.1/integration/metadata

curl "https://api.masraff.co/v1.1/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.1/integration/metadata/subcompany/subcompanyId


URL Parameters

Parameter Description
SubcompanyID The ID of subcompany in Masraff System

curl "https://api.masraff.co/v1.1/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.1/integration/expense/Id


URL Parameters

Parameter Description
Id The ID of expense retrieved from metadata

curl "https://api.masraff.co/v1.1/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",
     "Reimbursable": true,
     "Billable": false
     "CustomCode": "111"
}


Get a Specific Expense Details With Custom Fields

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



HTTP Request

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


URL Parameters

Parameter Description
Id The ID of expense retrieved from metadata

curl "https://api.masraff.co/v1.1/integration/expense/id/detail"

-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",
     "Reimbursable": true,
     "Billable": false,
     "CustomCode": "111",
     "CustomFields": [
        {
             "FieldName": "MasrafTest",
             "FieldValue": "Value",
             "FieldValueType": "String"
         }
     ]
}


Mark a Specific Expense Transfered

This endpoint marks a specific expense transfered.



HTTP Request

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


URL Parameters

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

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

-X POST

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:

                                     
 {
    "response": true
}
   
    

Get Expenses Of User

This endpoint returns all expense details and count of user



HTTP Request

GET api.masraff.co/v1.1/integration/user/expenses/personnelCode


URL Parameters

Parameter Description
Registration Number User's RegistrationNumber in Masraff system

curl "https://api.masraff.co/v1.1/integration/user/expenses/personnelCode"

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


 {
     [                
         expenses:{
             "Id: 665,
             "UserId": 5,
             "ReportId": 195,
             "CompanyId": 1,
             "CurrencyType": "TL",
             "ExpenseDate": "20171026",
             "CreateDate": "20171025",
             "Amount": 200,
             "TaxPercentage": 18,
             "TaxPercentageCode": "V1",
             "PersonnelCode": "P00023",
             "SubcompanyId": 1,
             "SubcompanyCode": "AA-123",
             "TaxAmount": 30.51, 
             "ExpenseTypeId": 3,
             "IntegrationCode": "OTL123A",
             "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",
             "Reimbursable": true,
             "Billable": false
        },
        ...
     ]
     "count": 5
 }

Expense Forms

Mark a Specific Expense Form Complete

This endpoint marks a specific expense form complete.



HTTP Request

POST api.masraff.co/v1.1/integration/report/id/complete


URL Parameters

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

curl "https://api.masraff.co/v1.1/integration/report/id/complete"

-X POST

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


 {
    "response": true
}


Get Expense Form Metadata For Company

This endpoint returns all untransferred expense form ids and count of company

This endpoint retrieves all unfetched expense form metada.



HTTP Request

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



curl "https://api.masraff.co/v1.1/integration/metadata/report"

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:

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

Get Expense Form Metadata For SubCompany

This endpoint returns all untransferred expense form ids and count of subcompany

This endpoint retrieves all unfetched expense form metada.



HTTP Request

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


URL Parameters

Parameter Description
SubcompanyID The ID of subcompany in Masraff System

curl "https://api.masraff.co/v1.1/integration/metadata/report/subcompany/3"

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:

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

Get a Specific Expense Form Details

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



HTTP Request

GET api.masraff.co/v1.1/integration/report/Id


URL Parameters

Parameter Description
Id The ID of expense form retrieved from metadata

curl "https://api.masraff.co/v1.1/integration/report/id"

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:

             
             ExpenseList:[                   
             {
                 "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",
                 "Reimbursable": true,
                 "Billable": false
                 "CustomCode": "111"
            },
                ...
            ] 
            
            
Create Custom Report

Create Custom Report

This endpoint create custom report.



HTTP Request

POST api.masraff.co/v1.1/integration/report/createCustomReport


URL Parameters

Parameter Description
ReportType The ID of custom form in Masraff system. int (notnullable)
ReportName string (notnullable)
CustomValues array (notnullable)
ReportOwner Report owner email in Masraff system. (notnullable)
SubCompanyCode string (notnullable if your company has subCompany)

Example Post


 {
         "ReportType":1,
         "ReportName":"CustomReportName",
         "ReportOwner":"user@email.com",
         "SubCompanyCode":"TEST",
         "CustomValues":
             [
                 {
                     "CustomFieldId":1,
                     "CustomFieldValue":"customValue"
                 },
                ...
             ]
 }

curl "https://api.masraff.co/v1.1/integration/report/createCustomReport"

-X POST

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


 {
    "response": true
}

Get Custom Report

Get Custom Report

This endpoint get specific custom report.



HTTP Request

POST api.masraff.co/v1.1/integration/report/getCustomReport/{reportId}


URL Parameters

Parameter Description
reportId The ID of custom form in Masraff system. int (notnullable)

curl "https://api.masraff.co/v1.1/integration/report/getCustomReport/{reportId}"

-X GET

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


 {
    "response": {
    "Id":1,
    "Name":"ReportName",
    "SubCompanyName":"SubCompanyName",
    "Status":"ReportStatus",
    "CustomValues":[
        {
            "FieldName":"FieldName",
            "FieldValue":"FieldValue",
            "FieldValueType":"FieldValueType"
        }
        ...
    ],
    "ReportOwner":"ReportOwner",
     }
}

Create Company

Create new company

This endpoint creating new company with given information



HTTP Request

POST api.masraff.co/v1.1/integration/company/create


URL Parameters

Parameter Description
Name The name of the company
AccountingType Accounting type of the company
Address Address of the company
Country Registered country of the company
Currency Company currency
Language Company language
Email Company email
FirstName Company owner's first name
LastName Company owner's last name
PhoneNumber Company owners phone number

curl "https://api.masraff.co/v1.1/integration/company/create"

-X POST

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


 {
    "response": true
}

Activate company subscription

Activate company subscription

This endpoint activating company subscription with given information



HTTP Request

POST api.masraff.co/v1.1/integration/company/subscription?email=emailaddress


URL Parameters

Parameter Description
Email The email of the company

curl "https://api.masraff.co/v1.1/integration/company/subscription?email=emailaddress"

-X POST

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


 {
    "response": true
}

Add company custom field value

Add custom field value

This endpoint creating custom field value with given information



HTTP Request

POST api.masraff.co/v1.1/integration/company/addCustomFieldValue


URL Parameters

Parameter Description
FieldId string (notnullable)
Values List<string> (notnullable)
ExpenseTypes List<string>

curl "https://api.masraff.co/v1.1/integration/company/addCustomFieldValue"

-X POST

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


 {
    "response": true
}

Get custom field value

Get field value

This endpoint creating custom field value with given information



HTTP Request

GET api.masraff.co/v1.1/integration/company/getCustomFieldValue/fieldId


URL Parameters

Parameter Description
FieldId int (notnullable)

curl "https://api.masraff.co/v1.1/integration/company/getCustomFieldValue/fieldId"

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:

    
{
     "response": [
         {
            "FieldId": 25,
            "ExpenseTypeCode": "ExpenseTypeCode",
            "Value": "CustomFieldValue",
        },
...
    ]
    }
    
    
Tags

Get Tags Metadata For Company

This endpoint returns all tags and count of company



HTTP Request

GET api.masraff.co/v1.1/integration/tag/taglist

curl "https://api.masraff.co/v1.1/integration/tag/taglist"

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


{
     "tags": [
        {
             "Id":"5",
             "Name":"TagName",
             "Description":"TagDescription"
         },
    ...
     ],
     "count": 5
 }




Create Tags Of Company

This endpoint create tags of company.



HTTP Request

POST api.masraff.co/v1.1/integration/tag/create


URL Parameters

Parameter Value
Name string (notnullable)
Description string

Example Post


[
     {
         "Name":"TagName",
         "Description":"TagDescription"
     },
...
 ]


curl "https://api.masraff.co/v1.1/integration/tag/create"

-X POST

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


 {
    "response": response message
    return "The information has been successfully inserted." if operation is success
}


Update Tags Of Company

This endpoint update tags of company.


HTTP Request

POST api.masraff.co/v1.1/integration/tag/update


URL Parameters

Parameter Description Value
Id The ID of Tag in Masraff system int(notnullable)
Name Tag Name string
Description Tag Decription string

Example Post


 [
     {
         "Id":5,
         "Name":"TagName",
         "Description":"TagDescription"
     },
    ...
 ]


curl "https://api.masraff.co/v1.1/integration/tag/update"

-X POST

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


 {
    "response": response message
    return "The information has been successfully upadated." if operation is success
}

SubCompanies

Get SubCompanies Metadata For Company

This endpoint returns all subcompanies and count of company



HTTP Request

GET api.masraff.co/v1.1/integration/subCompany/list

curl "https://api.masraff.co/v1.1/integration/subCompany/list"

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


{
     "subCompanies": [
        {
             "Id":5,
             "Name":"SubCompanyName",
             "Code":"SubCompany Code"
         },
    ...
     ],
     "count": 5
 }




Create SubCompany Of Company

This endpoint create subcompanies of company.



HTTP Request

POST api.masraff.co/v1.1/integration/subCompany/create


URL Parameters

Parameter Value
Name string(notnullable)
Description string

Example Post


[
     {
         "Name":"SubCompanyName",
         "Code":"SubCompanyCode"
     },
...
 ]


curl "https://api.masraff.co/v1.1/integration/subCompany/create"

-X POST

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


 {
    "response": response message
    return "The information has been successfully inserted." if operation is success
}


Update SubCompanies Of Company

This endpoint update subcompanies of company.


HTTP Request

POST api.masraff.co/v1.1/integration/subCompany/update


URL Parameters

Parameter Description Value
Id The ID of SubCompany in Masraff system int(notnullable)
Name SubCompany Name string(notnullable)
Code SubCompany Code string

Example Post


 [
     {
         "Id":5,
         "Name":"SubCompanyName",
         "Code":"SubCompanyCode"
     },
...
 ]


curl "https://api.masraff.co/v1.1/integration/subCompany/update"

-X POST

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


 {
    "response": response message
    return "The information has been successfully upadated." if operation is success
}

ExpenseTypes

Get ExpenseTypes Metadata For Company

This endpoint returns all expensetypes and count of company



HTTP Request

GET api.masraff.co/v1.1/integration/expenseType/list

curl "https://api.masraff.co/v1.1/integration/expenseTypes/list"

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


{
     "expenseTypes": [
        {
             "Id":"5",
             "Name":"Yemek",
             "Description":"İş Yemeği",
             "Code":"145.123.41.21",
             "IsDistanceExpenseType":"false",
             "MainExpenseType":"Yemek",
             "ExpenseTypeLimit":100,
             "SubCompanies":[
                "Ankara",
                "İstanbul",
                "İzmir"
            ]
         },
    ...
     ],
     "count": 5
 }




Create ExpenseType Of Company

This endpoint create expensetype of company.



HTTP Request

POST api.masraff.co/v1.1/integration/expenseType/create


MainExpenseTypeList in Masraff system

https://api.masraff.co/v1.1/integration/mainExpenseType/list


URL Parameters

Parameter Value
Name string(notnullable)
Code string
Description string
IsDistanceExpenseType boolean(notnullable)
MainExpenseType intMainExpenseTypeId in Masraff system (notnullable)
ExpenseTypeLimit decimal

Example Post


[
     {
         "Name":"Mesafe"
         "Code":"141.214.15"
         "Description":"KISISELARAC"
         "IsDistanceExpenseType":"true"
         "MainExpenseType":"Yemek",
         "ExpenseTypeLimit":10
     },
...
 ]


curl "https://api.masraff.co/v1.1/integration/expenseType/create"

-X POST

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


 {
    "response": response message
    return "The information has been successfully inserted." if operation is success
}


Update ExpenseType Of Company

This endpoint update expensetype of company.



HTTP Request

POST api.masraff.co/v1.1/integration/expenseType/update


URL Parameters

Parameter Value
Id int(notnullable)
Name string
Code string
Description string
ExpenseTypeLimit decimal

Example Post


[
     {
         "Id":1,
         "Name":"Mesafe",
         "Code":"141.214.15",
         "Description":"KISISELARAC",
         "ExpenseTypeLimit":10
     },
...
 ]


curl "https://api.masraff.co/v1.1/integration/expenseType/update"

-X POST

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


 {
    "response": response message
    return "The information has been successfully updated." if operation is success
}

Users

Get Users For Company

This endpoint returns all users and count of company



HTTP Request

GET api.masraff.co/v1.1/integration/user/list

curl "https://api.masraff.co/v1.1/integration/user/list"

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:

    
    {
         "users": [
            {
                 "Id":5,
                 "NameSurname":"Akın Işık",
                 "Email":"demo@masraff.co",
                 "ExpenseCenter":"M0123",
                 "PersonnelCode":"P0095",
                 "ApprovalLimit":"100",
                 "ApprovalUserLimit":"2",
                 "ArpCode":"195.076.001.1609"
             },
        ...
         ],
         "count": 5
     }
    
    



Create User Of Company

This endpoint create user of company.



HTTP Request

POST api.masraff.co/v1.1/integration/user/create


URL Parameters

Parameter Value
Email string (notnullable)
FirstName string (notnullable)
LastName string (notnullable)
PersonnelNumber string
ApprovalLimit decimal
ApproverUserEmail string(notnullable)
ApproverUserLimit decimal
ArpCode string
ExpenseCenter string

Example Post

    
    [
         {
             "FirstName":"Akın",
             "LastName":"Işık",
             "Email":"demo@masraff.co",
             "ApproverUserEmail":approver@masraff.co,
             "ApproverUserLimit":2,
             "ApprovalLimit":120,
             "ArpCode":"100.99.98",
             "ExpenseCenter":"M0123",
             "PersonnelCode":"P001"
         },
    ...
     ]
    
    

curl "https://api.masraff.co/v1.1/integration/user/create"

-X POST

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


 {
    "response": response message
    return "The information has been successfully inserted." if operation is success
}

    

Add User in SubCompany

This endpoint add user in subcompany of company.



HTTP Request

POST api.masraff.co/v1.1/integration/userSubCompany/add


URL Parameters

Parameter Description Value
UserList UserId's in Masraff system (ex:[1,2,3]) int array(notnullable)
SubCompanyId SubCompanyId in Masraff system int(notnullable)

Example Post


 {
     UserList:[1,5,10]
     SubCompanyId:5
 }


curl "https://api.masraff.co/v1.1/integration/userSubCompany/add"

-X POST

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


 {
    "response": true
}

Accounting

Create Account Codes Of Company

This endpoint create account codes of company.



HTTP Request

POST api.masraff.co/v1.1/integration/company/addAccountCodes


URL Parameters

Parameter Value
GlCode string (notnullable)
UserOHPCode string
CustomCode string
ExpenseTypeCode string
SubCompanyCode string
TagDescription string

Example Post

    
    [
         {
             "GlCode":"720.11.11",
             "UserOHPCode":"P012",
             "CustomCode":"1111",
             "ExpenseTypeCode":"OTO-123",
             "SubCompanyCode":"S-300",
             "TagDescription":"TagDescription"
         },
    ...
     ]
    
    

curl "https://api.masraff.co/v1.1/integration/company/addAccountCodes"

-X POST

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


 {
    "response": response message
    return "true" if operation is success
}

    

Create Tax Account Codes Of Company

This endpoint add tax account codes of company.



HTTP Request

POST api.masraff.co/v1.1/integration/company/addTaxAccountCodes


URL Parameters

Parameter Value
VatRate int(notnullable)
AccountCode string
Description string

Example Post


[
     {
         VatRate:8
         AccountCode:"192.168.1.1"
         Description:"description"
     },
    ...
]



curl "https://api.masraff.co/v1.1/integration/company/addTaxAccountCodes"

-X POST

-H "Authorization: yourMasraffApiKey"


The above command returns JSON structured like this:


 {
    "response": response message
    return "true" if operation is success
    }