Billing agreements API
39 min
Criado por Knowledge Engineering Team em 01/12/2020 16:52
Atualizado por Agente Zenvia - Jean em 09/08/2024 15:54

On this page

Billing agreements API concepts and usage

Object properties

Retrieve a billing agreement

Retrieve multiple billing agreements

Create a billing agreement

Update a billing agreement

Delete a billing agreement

Retrieve a billing agreement’s balance

 

 

Billing agreements API concepts and usage

This API can be used to manage Billing agreements by retrieving, creating, updating, and deleting agreements, and by retrieving information on time consumed and recorded expenses.

You can use the API to perform the same functions that can be accomplished manually in Configurations > Billing agreements, and to retrieve the same data that is included in the Billing agreement balance report.

 

API Base URL

All API endpoint URLs in this article use the following base URL:

https://api.movidesk.com/public/v1

 

Object properties

The Billing agreements API interacts with a large number of objects, all of which link back to a specific Billing agreement, or to a Billing agreement balance. These objects range from configuration parameters on the billing agreement, to time and expenses logged.

All of these objects and their properties can be retrieved by this API, but not all of them can be updated through the API.

For example, contact information for the Customer can be retrieved—but not updated—using the Billing agreements API. Instead you should use the People API to make updates to records in the People master file.

Clipboard

Note We apologize for the typos and inconsistent naming on a few objects and properties (there is quite a bit of history behind this!). We are working to fix these along with developing some new and improved APIs. We are also looking to minimize any impact to users of the current API versions.

 

Objects

Billing agreement

Person

Customer

Time log type

Consumption rate

Addressee

Billing agreement balance

Time log

Expense

Team

 

Billing agreement

One of the two primary objects of this API, which contains all the configuration and settings for the billing agreement.

JSON Paths

timeAgreement

Property

Type

Max length

Required?

Description

name

String

128

Yes

Name of the billing agreement.

id

Int

 

 

ID of the billing agreement. Read-only.

emailSubject

String

 

 

Subject of the scheduled report email.

emailDescription

String

 

 

Message of the scheduled report email.

emailAccount

String

 

 

Name of the support email account set as the Sender of scheduled report email.

Note that this should be the name configured in Configurations > Accounts, and not be the actual email address of the support email account.

emailSendDay

Byte

 

 

Day of month when the scheduled report email will be sent.

emailDestinations

Addressee array

 

 

Array of addressees for the scheduled report email.

isActive

Boolean

 

 

The billing agreement will not be linked to tickets and cannot be selected if set to false.

Billing agreements can be reactivated in Configurations > Billing agreements or through this API.

differentiateHoursFranchise

Boolean

 

 

Set to true in order to allot block hours by activity and time type, instead of consuming time from a single pool of block hours.

If left blank, the value will be set to false

differentiateHoursConsumption

Boolean

 

 

Set to true in order to configure different consumption rates for specific time types.

If left blank, the value will be set to false

accumulateUnusedHours

Boolean

 

 

Set to true in order to roll over unused block hours.

If left blank, the value will be set to false

renewalDay

Byte

 

Yes

Renewal day of month of the billing agreement.

contractedHours

Int

 

 

Total Monthly block hours of the billing agreement.

Read-only if differentiateHoursFranchise is set to true, as the system will calculate the total monthly block hours.

consumptionDeadline

Byte

 

 

Number of months until rolled over hours expire.

If left blank, rolled over hours will not expire.

baseAmount

Decimal

 

 

Monthly base amount of the billing agreement.

createdOn

UTC datetime

 

 

Date and time when the billing agreement was created. Read-only.

disabledDate

UTC datetime

 

 

Date and time when the billing agreement was disabled. Read-only.

typeActivities

Time log type array

 

Yes

Array of Hours and rates for different combinations of activities and time types.

timeTypeConsumption

Consumption rate array

 

 

Array of specific consumption rates for different time types.

clients

Customer array

 

Yes

Array of billing agreement customers.

 

Person

Object containing information about a record in the People master file, which can be either a user, or an organization.

All properties on this object are read-only. You can use the People API to update records in the People master file.

JSON Paths

timeAgreement.clients.organization
timeAgreementConsumption.timeAppointments.createdBy
timeAgreementConsumption.expenses.createdBy
timeAgreementConsumption.clients.organization

Property

Type

Max length

Required?

Description

id

String

64

 

Reference code of the person. Read-only.

personType

Int

1

 

Person type: 1=User, 2=Company, 4=Department. Read-only.

profileType

Int

1

 

Profile type: 1=Agent, 2=Customer, 3=Agent and Customer. Read-only.

businessName

String

128

 

Name of the user, or Trade name (DBA) of the organization. Read-only.

email

String

128

 

Main email address of the person. Read-only.

phone

String

128

 

Main phone number of the person. Read-only.

 

 

Customer

Very similar to the Person object, but includes a few additional properties. One property identifies the customer’s organization, and one flags whether the customer has been deleted.

If the customer is associated with more than one organization, each Customer object will correspond to a specific pair of the customer and an associated organization.

Clipboard

Note There are a few other address properties which are omitted from the table below, as they are only applicable for localized use of the system in Latin America:

  • cep
  • city
  • bairro
  • number

 

JSON Paths

timeAgreement.client
timeAgreementConsumption.client

Property

Type

Max length

Required?

Description

id

String

 

Yes

Reference code of the person. Read-only.

personType

Int

 

 

Person type: 1=User, 2=Company, 4=Department. Read-only.

profileType

Int

 

 

Profile type: 1=Agent, 2=Customer, 3=Agent and Customer. Read-only.

businessName

String

 

 

Name of the user, or Trade name (DBA) of the organization. Read-only.

email

String

 

 

Main email address of the person. Read-only.

phone

String

 

 

Main phone number of the person. Read-only.

Only returned for timeAgreementConsumption.client

isDeleted

Boolean

 

 

Returns true if the customer was deleted from the People master file, and false if not. Read-only.

organization

Person

 

 

Organization of the customer.

Note that if the customer is an organization itself, it may still be associated with a parent organization in Organization.

address

String

 

 

Address line 1 of the customer’s main address.

Only returned for timeAgreementConsumption.client

complement

String

 

 

Address line 2 of the customer’s main address.

Only returned for timeAgreementConsumption.client

reference

String

 

 

Address line 3 of the customer’s main address.

Only returned for timeAgreementConsumption.client

 

Time log type

This object corresponds to a line in the Hours and rates section of the billing agreement. Each of these objects contains billing information for a combination of an Activity and a Time type.

To update an existing Time log type, specify its id in the JSON data packet.

To create a new Time log type, either set id as 0 or omit the id property from the JSON data packet.

Clipboard

Note You can only obtain the value for id through this API. It cannot be found in Configurations > Billing agreements.  

 

JSON Paths

timeAgreement.typeActivities

Property

Type

Max length

Required?

Description

id

Int

 

 

ID of this activity and time type combination.

workingTimeType

String

128

 

Name of the Time type.

Leave blank to apply to all time types.

activity

String

128

 

Name of the Activity.

Leave blank to apply to all activities.

franchise

Int

 

 

Allotted hours for this activity and time type combination.

value

Decimal

 

 

Hourly rate for this activity and time type combination.

allowHoursExcedent

Boolean

 

 

Set to true to allow overages.

This will allow agents to log time to this activity and time type combination after all allotted hours have been consumed.

valueExceededHour

Decimal

 

 

Overage hourly rate for this activity and time type combination, which will be used instead of the standard Hourly rate.

Leave blank if the standard Hourly rate should be used.

shootdownContract

Boolean

 

Yes*

Set to true if time log entries for this activity and time type combination should consume block hours.

If contractedHours on the Billing agreement is greater than zero, this property should be set to true in at least one Time log type.

 

Consumption rate

This object corresponds to a line under the parameter Set consumption by time type in the billing agreement configurations—each line corresponds to a specific time type.

To update an existing Consumption rate, specify its id in the JSON data packet.

To create a new Consumption rate, either set id as 0 or omit the id property from the JSON data packet.

Clipboard

Note You can only obtain the value for id through this API. It cannot be found in Configurations > Billing agreements.  

 

JSON Paths

timeAgreement.timeTypeConsumption

Property

Type

Max length

Required?

Description

id

Int

 

 

ID of this consumption rate.

workingTimeType

String

128

 

Name of the Time type.

Leave blank to apply to all time types.

Value

Decimal

 

 

Consumption rate. For example:

0.50 = 50%
1.00 = 100%
1.25 = 125%
2.00 = 200%

 

Addressee

Object containing information about the addressee of the scheduled report email.

JSON Paths

timeAgreement.emailDestinations

Property

Type

Max length

Required?

Description

type

Int

1

 

Type of addressee: 0=Customers, 1=Specific addressee

If set to 0, the scheduled report email will be sent to all customers in the clients property.

email

String

 

Yes*

Email address of the addressee.

Only required when type is 1.

 

Billing agreement balance

Object containing balance information for a monthly billing period of a billing agreement.

All properties on this object are read-only.

JSON Paths

timeAgreementConsumption

Property

Type

Max length

Required?

Description

id

String

 

 

id of the billing period balance for the billing agreement. Read-only.

workingTimeAgreementId

String

 

 

id of the billing agreement. Read-only.

name

String

 

 

name of the billing agreement. Read-only.

baseAmount

Decimal

 

 

Monthly base amount of the billing agreement. Read-only.

exceededHourAmount

Decimal

 

 

Total overage hours for the billing period. Read-only.

renewalDay

Byte

 

 

Renewal day of month of the billing agreement. Read-only.

contractedHours

Int

 

 

Monthly block hours for the billing agreement. Read-only.

differentiateHoursFranchise

Boolean

 

 

Returns true if block hours are allotted by activity and time type, instead of consuming time from a single pool of block hours. Read-only.

differentiateHoursConsumption

Boolean

 

 

Returns true if there are specific consumption rates configured for different time types. Read-only.

period

UTC datetime

 

 

Month of the billing period. Read-only.

Uses the following format:

YYYY-MM-01T00:00:00

consumedHours

Double

 

 

Total block hours consumed in the billing period. Read-only.

Note that this property is calculated when the billing period is closed, and will always return 0 for the current billing period.

discount

Decimal

 

 

Discount on the total billable amount for the billing period. Read-only.

discountType

Int

 

 

Type of discount: 0=Percentage, 1=Amount.
Read-only.

timeAppointments

Time log array

 

 

Array of time logs linked to the billing agreement during the period. Read-only.

expenses

Expense array

 

 

Array of expenses linked to the billing agreement during the period. Read-only.

clients

Customer array

 

 

Array of customers linked to the billing agreement. Read-only.

 

Time log

Object containing details about a specific time log. Each time log is linked to a specific Billing agreement balance, based on the date of the time log and the billing agreement linked to the ticket containing the expense.

All properties on this object are read-only.

JSON Paths

timeAgreementConsumption.timeAppointments

Property

Type

Max length

Required?

Description

id

Int

 

 

ID of the time log. Read-only.

activity

String

 

 

Name of the Activity for the time log. Read-only.

date

UTC datetime

 

 

Date of the time log. Read-only.

Note that the time component will be retuned as zeroes:
YYYY-MM-DDT00:00:00

periodStart

Time

 

 

Start time for the time log. Read-only.

Returned in the following format: HH:MM:SS

periodEnd

Time

 

 

End time for the time log. Read-only.

Returned in the following format: HH:MM:SS

workTime

Time

 

 

Total time for the time log. Read-only.

Returned in the following format: HH:MM:SS

workTypeName

String

 

 

Name of the Time type for the time log. Read-only.

createdBy

Person

 

 

Creator of the ticket note. Read-only.

createdByTeam

Team

 

 

Team of the agent in createdBy. Read-only.

ticketNumber

String

 

 

Number of the ticket containing the time log. Read-only.

actionNumber

Int

 

 

Number of the ticket note containing the time log. Read-only.

 

Expense

Object containing details about a specific expense. Each expense is linked to a specific Billing agreement balance, based on the date of the expense and the billing agreement linked to the ticket containing the expense.

All properties on this object are read-only.

JSON Paths

timeAgreementConsumption.expenses

Property

Type

Max length

Required?

Description

id

Int

 

 

ID of the expense. Read-only.

type

String

 

 

Name of the expense type. Read-only.

serviceReport

String

 

 

Number of the service report that includes the expense. Read-only.

createdBy

Person

 

 

Creator of the ticket note. Read-only.

createdByTeam

String

 

 

Name of the associated team for the agent in createdBy. Read-only.

date

UTC datetime

 

 

Date for the expense. Read-only.

Note that the time component will be retuned as zeroes:
YYYY-MM-DDT00:00:00

quantity

Int

 

 

Quantity for the expense. Read-only.

value

Decimal

 

 

Monetary amount of the expense. Read-only.

 

Team

Object containing basic data to identify which team is associated with a Person object.

All properties on this object are read-only.

JSON Paths

timeAgreementConsumption.timeAppointments.createdByTeam
timeAgreementConsumption.expenses.createdByTeam

Property

Type

Max length

Required?

Description

id

Int

 

 

ID of the team. Read-only.

name

String

 

 

Name of the team. Read-only.

 

Retrieve a billing agreement

Retrieve all properties of a specific billing agreement.

GET: /timeAgreement

 

Parameters

Location

Type

Required?

Description

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

name

Query string

String

Yes

name of the billing agreement that will be retrieved

 

This example is a request to retrieve the billing agreement with the name “Online services – Western Manufacturing”, which returns all properties of that billing agreement.

Sample request

GET: https://api.movidesk.com/public/v1/timeAgreement?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&name=Online services – Western Manufacturing

Sample response

{
    "id": 62096,
    "name": "Online services – Western Manufacturing",
    "emailSubject": "Billing report\n",
    "emailDescription": "<p>Hello.</p>\r\n<p>&nbsp;</p>\r\n<p>As per your services agreement, please find your monthly services report attached.</p>\r\n<p>&nbsp;</p>\r\n<p>Sincerely,</p>\r\n<p>&nbsp;</p>\r\n<p>ABC Software</p>",
    "emailAccount": "ABC Software",
    "isActive": true,
    "differentiateHoursFranchise": true,
    "differentiateHoursConsumption": true,
    "accumulateUnusedHours": true,
    "renewalDay": 28,
    "contractedHours": 60,
    "consumptionDeadline": 6,
    "emailSendDay": 3,
    "baseAmount": 1000.00,
    "createdOn": "2019-11-20T19:41:31.5671157",
    "disabledDate": null,
    "typeActivities": [
        {
            "id": 965302,
            "activityId": 97638,
            "workingTimeType": "Overtime",
            "activity": "Online services",
            "franchise": 10,
            "value": 15.00,
            "valueExceededHour": 30.00,
            "shootdownContract": true,
            "allowHoursExcedent": true
        },
        {
            "id": 966328,
            "activityId": 97638,
            "workingTimeType": "Regular",
            "activity": "Online services",
            "franchise": 50,
            "value": 10.00,
            "valueExceededHour": 15.00,
            "shootdownContract": false,
            "allowHoursExcedent": true
        }
    ],
    "timeTypeConsumption": [
        {
            "id": 966327,
            "workingTimeType": "Overtime",
            "value": 1.50
        }
    ],
    "clients": [
        {
            "id": "1076070063",
            "personType": 1,
            "profileType": 2,
            "businessName": "Matthew Smith",
            "email": "matthew.smith@westernmanufacturing.com",
            "organization": {
                "id": "350002",
                "personType": 2,
                "profileType": 2,
                "businessName": "Western Manufacturing",
                "email": null,
                "phone": null
            }
        }
    ],
    "emailDestinations": [
        {
            "type": 0,
            "email": null
        }
    ]
}

 

Retrieve multiple billing agreements

Retrieve specific properties from multiple billing agreements.

GET: /timeAgreement

 

Parameters

Location

Type

Required?

Description

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

$select

Query string

OData

Yes

Comma delimited list of which object properties should be retrieved

$expand

Query string

OData

 

Comma delimited list of which properties should be expanded.

For example, expand the clients property to retrieve the nested Customer objects and their properties.

$filter

Query string

OData

 

Expressions to specify which billing agreements should be retrieved.

$orderby

Query string

OData

 

Determines whether objects will be retrieved in ascending (asc) or descending (desc) order.

Has asc as the default value.

$top

Query string

OData

 

Determines how many billing agreements should be retrieved. Used for paging results.

$skip

Query string

OData

 

Determines how many billing agreements should be skipped before retrieving records. Used for paging results.

 

Head with gears

Tip See the official OData guide on query options for details on how to sort, filter, and page the results.

 

This example is a request to retrieve the name, contractedHours, baseAmount and clients properties of a subset of billing agreements.

The request is filtering down to billing agreements which are linked to at least one customer that is associated with the organization with id 350002.

The response shows two billing agreements that fit the filter criteria.

Clipboard

Note The $filter parameter uses single quotation marks on strings, instead of double quotation marks.

 

Sample request

GET: https://api.movidesk.com/public/v1/timeAgreement?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&$select=name,contractedHours,baseAmount,clients&$filter=clients/any(c: c/organization/id eq '350002')&$expand=clients($expand=organization)

Sample response

[
    {
        "baseAmount": 1000.00,
        "contractedHours": 60,
        "name": "Online services – Western Manufacturing",
        "clients": [
            {
                "organization": {
                    "id": "350002",
                    "personType": 2,
                    "profileType": 2,
                    "businessName": "Western Manufacturing",
                    "email": null,
                    "phone": null,
                    "pathPicture": null
                },
                "id": "1076070063",
                "personType": 1,
                "profileType": 2,
                "businessName": "Matthew Smith",
                "email": "matthew.smith@westernmanufacturing.com"
            }
        ]
    },
    {
        "baseAmount": 500.00,
        "contractedHours": 20,
        "name": "Onsite server maintenance - Western Manufacturing",
        "clients": [
            {
                "organization": {
                    "id": "350002",
                    "personType": 2,
                    "profileType": 2,
                    "businessName": "Western Manufacturing",
                    "email": null,
                    "phone": null,
                    "pathPicture": null
                },
                "id": "1724091295",
                "personType": 1,
                "profileType": 2,
                "businessName": "Sally Anderson",
                "email": null
             }
        ]
    }
]

 

Create a billing agreement

Create a new billing agreement.

POST: /timeAgreement

 

Parameters

Location

Type

Required?

Description

Content-Type

Header

Content type

Yes

Should always be application/json

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

Billing agreement properties

Body

JSON

 

Properties of the new billing agreement.

 

This example is a request to create a new billing agreement with the name “Online services – NewCo” using the same settings as one of our previous examples, but for the customer with id “c7e951fe-0210-459c-“.

The API returns a Status 200 (OK) and all properties of the new billing agreement.

Clipboard

Note The property id will be ignored if it is included in the JSON content of the request, but will not cause an error.

 

Sample request

POST: https://api.movidesk.com/public/v1/timeAgreement?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Headers: Content-Type: application/json

  {
    "name": "Online services – NewCo",
    "emailSubject": "Billing report\n",
    "emailDescription": "<p>Hello.</p>\r\n<p>&nbsp;</p>\r\n<p>As per your services agreement, please find your monthly services report attached.</p>\r\n<p>&nbsp;</p>\r\n<p>Sincerely,</p>\r\n<p>&nbsp;</p>\r\n<p>ABC Software</p>",
    "emailAccount": "ABC Software",
    "isActive": true,
    "differentiateHoursFranchise": true,
    "differentiateHoursConsumption": true,
    "accumulateUnusedHours": true,
    "renewalDay": 28,
    "contractedHours": 60,
    "consumptionDeadline": 6,
    "emailSendDay": 3,
    "baseAmount": 1000.00,
    "typeActivities": [
        {
            "activityId": 97638,
            "workingTimeType": "Overtime",
            "activity": "Online services",
            "franchise": 10,
            "value": 15.00,
            "valueExceededHour": 30.00,
            "shootdownContract": true,
            "allowHoursExcedent": true
        },
        {
            "activityId": 97638,
            "workingTimeType": "Regular",
            "activity": "Online services",
            "franchise": 50,
            "value": 10.00,
            "valueExceededHour": 15.00,
            "shootdownContract": false,
            "allowHoursExcedent": true
        }
    ],
    "timeTypeConsumption": [
        {
            "workingTimeType": "Overtime",
            "value": 1.50
        }
    ],
    "clients": [
        {
            "id": "c7e951fe-0210-459c-",
            "personType": 1,
            "profileType": 2,
            "businessName": "Logan Jensen",
            "email": "logan.jensen@newco.com",
            "organization": {
                "id": "350007",
                "personType": 2,
                "profileType": 2,
                "businessName": "NewCo",
                "email": null,
                "phone": null
            }
        }
    ],
    "emailDestinations": [
        {
            "type": 0,
            "email": null
        }
    ]
}

Sample response

{
    "id": 62155,
    "name": "Online services – NewCo",
    "emailSubject": "Billing report\n",
    "emailDescription": "<p>Hello.</p>\r\n<p>&nbsp;</p>\r\n<p>As per your services agreement, please find your monthly services report attached.</p>\r\n<p>&nbsp;</p>\r\n<p>Sincerely,</p>\r\n<p>&nbsp;</p>\r\n<p>ABC Software</p>",
    "emailAccount": "ABC Software",
    "isActive": true,
    "differentiateHoursFranchise": true,
    "differentiateHoursConsumption": true,
    "accumulateUnusedHours": true,
    "renewalDay": 28,
    "contractedHours": 60,
    "consumptionDeadline": 6,
    "emailSendDay": 3,
    "baseAmount": 1000.00,
    "createdOn": "2019-11-24T00:08:35.2358045Z",
    "disabledDate": null,
    "typeActivities": [
        {
            "id": 967031,
            "activityId": 97638,
            "workingTimeType": "Overtime",
            "activity": "Online services",
            "franchise": 10,
            "value": 15.00,
            "valueExceededHour": 30.00,
            "shootdownContract": true,
            "allowHoursExcedent": true
        },
        {
            "id": 967032,
            "activityId": 97638,
            "workingTimeType": "Regular",
            "activity": "Online services",
            "franchise": 50,
            "value": 10.00,
            "valueExceededHour": 15.00,
            "shootdownContract": false,
            "allowHoursExcedent": true
        }
    ],
    "timeTypeConsumption": [
        {
            "id": 967033,
            "workingTimeType": "Overtime",
            "value": 1.50
        }
    ],
    "clients": [
        {
            "id": "c7e951fe-0210-459c-",
            "personType": 1,
            "profileType": 2,
            "businessName": "Logan Jensen",
            "email": "logan.jensen@newco.com",
            "organization": {
                "id": "350007",
                "personType": 2,
                "profileType": 2,
                "businessName": "NewCo",
                "email": null,
                "phone": null
            }
        }
    ],
    "emailDestinations": [
        {
            "type": 0,
            "email": null
        }
    ]
}

 

Update a billing agreement

Make changes to a billing agreement by sending JSON key/value pairs for the properties you want to change.

Warning

Warning Updating array properties such as clients will replace all values in the array with the values in your request.

 

PATCH: /timeAgreement

 

Parameters

Location

Type

Required?

Description

Content-Type

Header

Content type

Yes

Should always be application/json

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

name

Query string

String

Yes

name of the billing agreement that will be retrieved

Billing agreement properties

Body

JSON

 

Properties to be updated.

 

This example is a request to update the billing agreement with name “Online services – NewCo”, which was created in the previous example.

The request is changing the Monthly base amount to 1,500.00.

The API returns a status, but no JSON data.

Clipboard

Note The property id will be ignored if it is included in the JSON content of the request, but will not cause an error.

 

Sample request

PATCH: https://api.movidesk.com/public/v1/timeAgreement?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&name=Online services – NewCo
Headers: Content-Type: application/json

{
"baseAmount": 1500.00
}

 

Delete a billing agreement

Delete an existing billing agreement.

DELETE: /timeAgreement

 

Parameters

Location

Type

Required?

Description

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

name

Query string

String

Yes

name of the billing agreement that will be deleted

 

This example is a request to delete the billing agreement with name “Online services – NewCo”

The API returns a status, but no JSON data.

Sample request

DELETE: https://api.movidesk.com/public/v1/timeAgreement?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX& name=Online services – NewCo

 

Retrieve a billing agreement’s balance

Retrieve all time consumption and billing information for a specific billing agreement.

GET: /timeAgreementConsumption

 

Parameters

Location

Type

Required?

Description

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

name

Query string

String

Yes

name of the billing agreement that will be retrieved

 

This example is a request to retrieve billing and time consumption information for the billing agreement with the name “Online services – Western Manufacturing”

The response includes all properties of the Billing agreement balance objects. In this example there is only one billing period returned.

Sample request

GET: https://api.movidesk.com/public/v1/timeAgreementConsumption?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&name=Online services – Western Manufacturing

Sample response

[
    {
        "id": 0,
        "name": "Online services – Western Manufacturing",
        "baseAmount": 1000.00,
        "exceededHourAmount": 0.0,
        "workingTimeAgreementId": 62096,
        "renewalDay": 28,
        "contractedHours": 60,
        "differentiateHoursFranchise": true,
        "differentiateHoursConsumption": true,
        "period": "2019-10-01T00:00:00",
        "consumedHours": 7.0,
        "discount": null,
        "discountType": null,
        "timeAppointments": [
            {
                "id": 24408643,
                "activity": "Online services",
                "date": "2019-10-14T00:00:00",
                "periodStart": "20:32:13",
                "periodEnd": "21:39:13",
                "workTime": "01:07:00",
                "workTypeName": "Overtime",
                "createdBy": {
                    "id": "2092726773",
                    "personType": 1,
                    "profileType": 3,
                    "businessName": "John Stewart",
                    "email": "john.stewart@abcsoftware.com",
                    "phone": "(555) 383-9134"
                },
                "createdByTeam": {
                    "id": 61816,
                    "name": "Level 1 Agents"
                },
                "ticketNumber": "1",
                "actionNumber": 1
            },
            {
                "id": 24044849,
                "activity": "Online services",
                "date": "2019-10-06T00:00:00",
                "periodStart": "14:32:28",
                "periodEnd": "20:25:28",
                "workTime": "05:53:00",
                "workTypeName": "Overtime",
                "createdBy": {
                    "id": "2092726773",
                    "personType": 1,
                    "profileType": 3,
                    "businessName": "John Stewart",
                    "email": "john.stewart@abcsoftware.com",
                    "phone": "(555) 383-9134"
                },
                "createdByTeam": {
                    "id": 61816,
                    "name": "Level 1 Agents"
                },
                "ticketNumber": "1",
                "actionNumber": 3
            }
        ],

        "typeActivities": [
            {
                "id": 965302,
                "activityId": 97638,
                "workingTimeType": "Overtime",
                "activity": "Online services",
                "franchise": 10,
                "value": 15.00,
                "valueExceededHour": 30.00,
                "shootdownContract": true,
                "allowHoursExcedent": true
            },
            {
                "id": 966328,
                "activityId": 97638,
                "workingTimeType": "Regular",
                "activity": "Online services",
                "franchise": 50,
                "value": 10.00,
                "valueExceededHour": 15.00,
                "shootdownContract": false,
                "allowHoursExcedent": true
            }
        ],
        "expenses": [
            {
                "id": 14085,
                "type": "Dedicated server setup",
                "serviceReport": "0",
                "createdBy": {
                    "id": "1076070063",
                    "personType": 1,
                    "profileType": 3,
                    "businessName": "John Stewart",
                    "email": "john.stewart@abcsoftware.com",
                    "phone": "(555) 383-9134"
                },
                "createdByTeam": null,
                "date": "2019-10-06T00:00:00",
                "quantity": null,
                "value": 200.00
            }
        ],
        "clients": [
            {
                "id": "1076070063",
                "personType": 1,
                "profileType": 2,
                "businessName": "Matthew Smith",
                "email": "matthew.smith@westernmanufacturing.com",
                "organization": {
                    "id": "350002",
                    "personType": 2,
                    "profileType": 2,
                    "businessName": "Western Manufacturing",
                    "email": null,
                    "phone": null
                }
            }
        ]
    }
]

 

Classifique este artigo
Últimos artigos visitados