Create Expense Codes (BULK)


POST /v2/api/corporate/expenseCode/bulk

For corporates that wish to integrate internal trip approval flows with the Expense Code feature, the following process may be followed:

  • Expense Code to be made mandatory for all employees of the corporate.
  • No expense code created for any of the employees by default - By extension, these employees wouldn't be able to take rides marked as corporate unless they have a valid expense code.
  • Through internal approval flows, corporates pre-approve or reject rides for employees and internal Travel Request is created for the employee.
  • Through Ola Corporate APIs, the expense code is created for the respective employees - once an expense code is available for an employee, the employee may take rides.
  • Once the request expires on the corporate's system, they may call the Ola Corporate API to delete the API.

Request Parameters

Name Data Type Description Type Remark
expense_code string Expense Code Name Payload Mandatory
capping map

Capping

  • start_time (Date), format:"dd-MM-yyyy hh:mm:ss"
  • end_time (Date), should be greater than start_date and same format
  • ride_cap (Integer), Should be > 0
Payload Optional
scopes list of objects

Scopes

  • expense_code_creation_level (string), values are case sensitive and allowed - { CORPORATE/GROUP/EMPLOYEE }, Mandatory
  • expense_code_created_for (string), Mandatory for GROUP and EMPLOYEE
Payload Mandatory
  • Example Request

    POST

    https://devapi.olacabs.com/v2/api/corporate/expenseCode/bulk

    
        [
          {
            "expense_code": "MyExpenseCode1",
            "scopes": [
              {
                "expense_code_creation_level": "EMPLOYEE1",
                "expense_code_created_for": "test.user@abc.com"
              },
              {
                "expense_code_creation_level": "GROUP1",
                "expense_code_created_for": "ExampleGroup"
              },
              {
                "expense_code_creation_level": "CORPORATE",
                "expense_code_created_for": null
              }
            ],
            "capping": {
              "start_time": "08-01-2017 00:09:11",
              "end_time": "12-01-2018 00:19:00",
              "ride_cap": 10
            }
          },
          {
            "expense_code": "MyExpenseCode2",
            "scopes": [
              {
                "expense_code_creation_level": "EMPLOYEE2",
                "expense_code_created_for": "test.user@abc.com"
              },
              {
                "expense_code_creation_level": "EMPLOYEE3",
                "expense_code_created_for": "xyz@corporate_partners.com"
              },
              {
                "expense_code_creation_level": "GROUP2",
                "expense_code_created_for": "ExampleGroup"
              },
              {
                "expense_code_creation_level": "GROUP2",
                "expense_code_created_for": "testtesttest"
              },
              {
                "expense_code_creation_level": "CORPORATE",
                "expense_code_created_for": null
              },
              {
                "expense_code_creation_level": "CORPORATE",
                "expense_code_created_for": null
              }
            ],
            "capping": {
              "start_time": "08-01-2017 00:09:11",
              "end_time": "12-01-2018 00:19:00",
              "ride_cap": 100
            }
          }
        ]
    
        Headers: {
          X-CORPORATE-TOKEN: fd5d4d3726121212f12ff12f12f1f12f1f12fa
        }
    
    

    Example Response (Success)

    
        {
          "successful_expense_codes": 2,
          "failed_expense_codes": 0,
          "expense_code_responses": [
            {
              "expense_code": "MyExpenseCode1",
              "expense_code_created": true,
              "successful_scopes": 1,
              "failed_scopes": 2,
              "expense_code_message": "Expense code successfully created",
              "expense_code_scope_error_dtos": [
                {
                  "entity_type": "EMPLOYEE1",
                  "entity_created_as": "test.user@abc.com",
                  "entity_error": "Scope addition failed, type can only be EMPLOYEE, GROUP or\nCORPORATE",
                  "successful": false
                },
                {
                  "entity_type": "GROUP1",
                  "entity_created_as": "ExampleGroup",
                  "entity_error": "Scope addition failed, type can only be EMPLOYEE, GROUP or\nCORPORATE",
                  "successful": false
                },
                {
                  "entity_type": "CORPORATE",
                  "entity_created_as": "NA",
                  "entity_error": "Successfully Added",
                  "successful": true
                }
              ]
            },
            {
              "expense_code": "MyExpenseCode2",
              "expense_code_created": true,
              "successful_scopes": 1,
              "failed_scopes": 5,
              "expense_code_message": "Expense code successfully created",
              "expense_code_scope_error_dtos": [
                {
                  "entity_type": "EMPLOYEE2",
                  "entity_created_as": "test.user@abc.com",
                  "entity_error": "Scope addition failed, type can only be EMPLOYEE, GROUP or\nCORPORATE",
                  "successful": false
                },
                {
                  "entity_type": "EMPLOYEE3",
                  "entity_created_as": "xyz@corporate_partners.com",
                  "entity_error": "Scope addition failed, type can only be EMPLOYEE, GROUP or\nCORPORATE",
                  "successful": false
                },
                {
                  "entity_type": "GROUP2",
                  "entity_created_as": "ExampleGroup",
                  "entity_error": "Scope addition failed, type can only be EMPLOYEE, GROUP or\nCORPORATE",
                  "successful": false
                },
                {
                  "entity_type": "GROUP2",
                  "entity_created_as": "testtesttest",
                  "entity_error": "Scope addition failed, type can only be EMPLOYEE, GROUP or\nCORPORATE",
                  "successful": false
                },
                {
                  "entity_type": "CORPORATE",
                  "entity_created_as": "NA",
                  "entity_error": "Successfully Added",
                  "successful": true
                },
                {
                  "entity_type": "CORPORATE",
                  "entity_created_as": "NA",
                  "entity_error": "Scope already exists",
                  "successful": false
                }
              ]
            }
          ]
        }