NAV Navbar
shell javascript

Introduction

Welcome to the Seven Time API! You can use our API to access Seven Time API endpoints.

You can view code examples for Shell and JavaScript in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Authentication

To authorize, use this code:

# With shell, you can just pass the correct header with each request
curl "api_endpoint_here" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Send Client-Secret in the header. Sample with the request library */

let options = {
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.post(options, function (error, response, body) {
  // ....
});

Make sure to replace thisismysecretkey with your API key.

Seven Time uses API keys to allow access to the API. You can get a new Seven Time API key in "Settings -> Integrations -> API" in Seven Time.

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

Client-Secret: thisismysecretkey

Header fields

In addition to the 'Client-Secret', a few fields are required in the Header:

Actions

The Seven Time API supports four different actions:

Pagination

Searches that returns a large number of results are paged due to performance reasons.

These searches are limited by the parameter 'limit'. This parameter limits the number of results that will be returned. By default (if not specified), this limit is set to 100 but can be set as low as 1 and as high as 500.

When the number of results exceed the given limit, the 'page' parameter can be used to retrieve different intervals in the data. By default (if not specified), this value is set to 1.

Example of 'limit' and 'page'

A search returns 490 results and the limit is set to 100. To get the first 100 results, the parameter 'page' is set to 1. To get the next 100 results, 'page' is set to 2, etc.

The data returned will be in the form of a JSON and contain a meta property where you will find information about the total number of results, number of pages and the current page. The data property contains the information requested.

{
  "meta": {
    "totalResources": 490,
    "totalPages": 5,
    "currentPage": 2
  },
  "data": [
    {
      // ...
    },
    {
      // ...
    }
  ]
}

Rate-limit

When the number of requests reach the rate limit the HTTP 429 (Too Many Requests) is returned. The limit is 4 requests per second. This equals to a bit more than 200 requests per minute.

Errors

The Seven Time API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The resource requested is hidden for administrators only.
404 Not Found -- The specified resource could not be found.
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.

When applicable the error message will be available in the response as errorMessage.

Contact Persons

Get Contact Persons

curl "https://app.seventime.se/api/2/contactPersons/?limit=2&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/contactPersons/?limit=5&page=1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 3,
    "totalPages": 1,
    "currentPage": 1
  },
  "data": [
    {
      "_id": "5fb7bcd0ab7bb01d4d54832",
      "name": "Anna",
      "title": "Utvecklare",
      "workPhone": "",
      "cellPhone": "",
      "email": "email@company.com",
      "customer": "5bb26376c4nj551167",
      "customerName": "Anna Andersson",
      "mainContact": true,
      "isActive": true,
      "createdDate": "2020-11-17T12:06:24.281Z",
      "modifiedDate": "2020-11-17T12:06:24.281Z"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves contact persons.

HTTP Request

GET https://app.seventime.se/api/2/contactPersons

Query Parameters

E.g. https://app.seventime.se/api/2/contactPersons/?customerId=5bb26376c4nj551167

Parameter Default Description
customerId The id of the customer which the contact persons belong to. If not specified, all contact persons will be retrivied, regardless of which customer they belong to
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Contact Person

curl "https://app.seventime.se/api/2/contactPersons/5fb7bcd0ab7bb01d4d798762" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/contactPersons/5fb7bcd0ab7bb01d4d798762";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "_id": "5fb7bcd0ab7bb01d4d54832",
    "name": "Anna",
    "title": "Utvecklare",
    "workPhone": "",
    "cellPhone": "",
    "email": "email@company.com",
    "customer": "5bb26376c4nj551167",
    "customerName": "Anna Andersson",
    "mainContact": true,
    "isActive": true,
    "createdDate": "2020-11-17T12:06:24.281Z",
    "modifiedDate": "2020-11-17T12:06:24.281Z",
  }
}

This endpoint retrieves a contact person.

HTTP Request

GET https://app.seventime.se/api/2/contactPersons/<_id>

URL Parameters

Parameter Description
_id The _id of the contact person to retrieve

Customers

Get Customers

curl "https://app.seventime.se/api/2/customers/?limit=10&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/customers/?limit=10&page=1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 33,
    "totalPages": 4,
    "currentPage": 2
  },
  "data": [
    {
      "_id": "571f61330c7f498a2d5812",
      "customerNumber": "733352",
      "vatNumber": "SE555708197354",
      "organizationNumber": "555555-5555",
      "email": "email@company.com",
      "phone": "1234-123456",
      "city": "Stockholm",
      "zipCode": "123 45",
      "address": "Ă–stra Gatan 129",
      "name": "Anna Andersson",
      "documents": [],
      "billingSettings": {
        "useSeparateBillingAddress": false,
        "address": "",
        "address2": "",
        "zipCode": "",
        "city": "",
        "useSeparateBillingEmail": false,
        "invoiceEmail": "",
        "invoiceDeliveryType": 0,
        "defaultEmailSubject": "",
        "isConstructionCompany": false,
        "isROTCustomer": true,
        "isRUTCustomer": false,
        "typeOfProperty": 1,
        "propertyDescription": "",
        "housingSocietyNumber": "",
        "apartmentNumber": "",
        "personalNumber": "",
        "deductionDistribution": [
          {
            "itemId": "0.40862768612862976",
            "userName": "Anna Andersson",
            "personalNumber": "555555-5555",
            "distributionPercent": 100,
            "_id": "5bb2683d3a0f154899"
          }
        ],
        "expenseDiscount": 0,
        "expenseCustomProfitMargin": 0,
        "markupPercentSupplierInvoice": -1000,
        "priceList": null,
        "priceListName": ""
      },
      "modifiedDate": "2018-10-01T18:12:06.025Z",
      "createdDate": "2018-10-01T18:12:06.025Z",
      "address2": "",
      "country": "",
      "billingMethod": "",
      "pricePerHour": 0,
      "paymentDays": 20,
      "notes": "",
      "isActive": true
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves customers.

HTTP Request

GET https://app.seventime.se/api/2/customers

Query Parameters

E.g. https://app.seventime.se/api/2/customers/?limit=10&page=1&organizationNumber=555555-5555

Parameter Default Description
name If specified, customers that match the parameter will be included.
customerNumber If specified, customers that match the parameter will be included.
organizationNumber If specified, customers that match the parameter will be included.
city If specified, customers that match the parameter will be included.
lastModified If specified, customers that has been modified since the specified timestamp will be included. Accepted formats: 'YYYY-MM-HH HH:MM', 'YYYY-MM-HH HH:MM:SS', 'YYYY-MM-HHTHH:MM', 'YYYY-MM-HHTHH:MM:SS'
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Customer

curl "https://app.seventime.se/api/2/customers/571f61330c7f4124592b" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/customers/571f61330c7f4124592b";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "_id": "571f61330c7f498a364892",
    "customerNumber": "733352",
    "vatNumber": "SE555702476792",
    "organizationNumber": "555555-5555",
    "email": "email@company.com",
    "phone": "1234-123456",
    "city": "Stockholm",
    "zipCode": "123 45",
    "address": "Ă–stra Gatan 129",
    "name": "Anna Andersson",
    "documents": [],
    "billingSettings": {
      "useSeparateBillingAddress": false,
      "address": "",
      "address2": "",
      "zipCode": "",
      "city": "",
      "useSeparateBillingEmail": false,
      "invoiceEmail": "",
      "invoiceDeliveryType": 0,
      "defaultEmailSubject": "",
      "isConstructionCompany": false,
      "isROTCustomer": true,
      "isRUTCustomer": false,
      "typeOfProperty": 1,
      "propertyDescription": "",
      "housingSocietyNumber": "",
      "apartmentNumber": "",
      "personalNumber": "",
      "deductionDistribution": [
        {
          "itemId": "0.40862768612862976",
          "userName": "Anna Andersson",
          "personalNumber": "555555-5555",
          "distributionPercent": 100,
          "_id": "5bb2683d3a0fdb85133"
        }
      ],
      "expenseDiscount": 0,
      "expenseCustomProfitMargin": 0,
      "markupPercentSupplierInvoice": -1000,
      "priceList": null,
      "priceListName": ""
    },
    "modifiedDate": "2018-10-01T18:12:06.025Z",
    "createdDate": "2018-10-01T18:12:06.025Z",
    "address2": "",
    "country": "",
    "billingMethod": "",
    "pricePerHour": 0,
    "paymentDays": 20,
    "notes": "",
    "isActive": true
  }
}

This endpoint retrieves a specific customer.

HTTP Request

GET https://app.seventime.se/api/2/customers/<_id>

URL Parameters

Parameter Description
_id The _id of the customer to retrieve

Create a Customer

Curl -X POST "https://app.seventime.se/api/2/customers/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"createdByUser":"5f48eb3e65d7ee8984354b","name":"Anna Andersson","address":"Ă–stra Gatan 129","zipCode":"123 45","city":Stockholm","phone":1234-123456","email":"email@company.com","organizationNumber":"555555-5555"}'
let jsonData = {
  createdByUser: '5f48eb3e65d7ee8984354b',
  name: 'Anna Andersson',
  address: 'Ă–stra Gatan 129',
  zipCode: '123 45',
  city: 'Stockholm',
  phone: '1234-123456',
  email: 'email@company.com',
  organizationNumber: '555555-5555'
};

let options = {
  url: 'https://app.seventime.se/api/2/customers',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.post(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
  } else {
    console.error("ERROR! Unable to create customer: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{
  "_id": "571f61330c7f498a4712448b",
  "customerNumber": "733352",
  "organizationNumber": "555555-5555",
  "email": "email@company.com",
  "phone": "1234-123456",
  "city": "Stockholm",
  "zipCode": "123 45",
  "address": "Ă–stra Gatan 129",
  "name": "Anna Andersson",
  "documents": [],
  "billingSettings": {
    "deductionDistribution": []
  },
  "modifiedDate": "2018-10-01T18:12:06.025Z",
  "createdDate": "2018-10-01T18:12:06.025Z",
  "isActive": true
}

This endpoint creates a specific customer.

HTTP Request

POST https://app.seventime.se/api/2/customers/

POST Parameters

Parameter Type Required? Description
createdByUser String Yes Id of the user who created the customer
name String Yes Name of the customer
customerNumber String No Customer number. If specified it has to be unique otherwise an error will be returned. If not specified it will be set automatically.
address String No Address
address2 String No Address 2
zipCode String No Zip code
city String No City
country String No Country code
phone String No Phone number
email String No Email address
organizationNumber String No Organization number or Personal number
vatNumber String No VAT number
paymentDays Number No Payment days for the user
deliveryAddress Object No Contains attributes specific for delivery. See below for details.
billingSettings Object No Contains attributes specific for billing. See below for details.

Attributes for deliveryAddress

Parameter Type Required? Description
name String No Name on delivery address
address String No Primary delivery address
address2 String No Secondary delivery address
zipCode String No Zip code
city String No City
country String No Country
phone String No Phone number

Attributes for billingSettings

Parameter Type Required? Description
useSeparateBillingAddress Boolean No Should an alternative billing address be used?
address String No Used if useSeparateBillingAddress is true
address2 String No Used if useSeparateBillingAddress is true
zipCode String No Used if useSeparateBillingAddress is true
city String No Used if useSeparateBillingAddress is true
useSeparateBillingEmail Boolean No If 'invoiceEmail' should be used
invoiceEmail String No Used for invoices if useSeparateBillingEmail is true
invoiceDeliveryType Number No Empty or 0 = Email, 10 = Postal letter, 20 = Svefaktura
defaultEmailSubject String No Default email subject for invoices
isConstructionCompany Boolean No Is construction company
isROTCustomer Boolean No Is ROT customer
isRUTCustomer Boolean No Is RUT customer
typeOfProperty Number No 1 = Detached property, 2 = Condominium
propertyDescription String No Swedish: Fastighetsbeteckning
housingSocietyNumber String No Swedish: Orgnr för bostadsrättsförening
apartmentNumber String No Swedish: Lägenhetsnummer
deductionDistribution Array No Array of DeductionItem's. See below for details.

Attributes for DeductionItem

DeductionItem is used to distribute ROT / RUT work

Parameter Type Required? Description
userName String Yes Full name of person
personalNumber String Yes Personal number
distributionPercent Number Yes 1-100

Update a Customer

curl -X PUT "https://app.seventime.se/api/2/customers/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"571f61330c7f498a4712448b","modifiedByUser":"5f48eb3e65d7ee49649eeb","name":"Company AB","customerNumber":"733352"}' 
let jsonData = {
  _id: '571f61330c7f498a4712448b',
  modifiedByUser: '5f48eb3e65d7ee49649eeb',
  name: 'Company AB',
  customerNumber: '733352'
};

let options = {
  url: 'https://app.seventime.se/api/2/customers',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.put(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Customer updated: " + body.name + ", _id: " + body._id);

  } else {
    console.error("ERROR! Unable to update customer: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{
  "_id": "571f61330c7f498a4712448b",
  "customerNumber": "733352",
  "organizationNumber": "555555-5555",
  "email": "email@company.com",
  "phone": "1234-123456",
  "city": "Stockholm",
  "zipCode": "123 45",
  "address": "Ă–stra Gatan 129",
  "name": "Company AB",
  "documents": [],
  "billingSettings": {
    "deductionDistribution": []
  },
  "modifiedDate": "2018-10-01T18:12:06.025Z",
  "createdDate": "2018-10-01T18:12:06.025Z",
  "isActive": true  
}
"Customer updated: Company AB, _id: 571f61330c7f498a4712448b"

This endpoint updates a customer.

HTTP Request

PUT https://app.seventime.se/api/2/customers/

PUT Parameters

The table below shows the required fields. Other available fields can be found in the section 'Create a Customer'.

Parameter Type Required? Description
_id String Yes Id of the customer
modifiedByUser String Yes Id of the user who updated the customer

Departments

Get Departments

curl "https://app.seventime.se/api/2/departments" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/departments";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 3,
    "totalPages": 1,
    "currentPage": 1
  },
  "data": [
    {
      "_id": "59d05abdc471b72e4979135",
      "name": "Utveckling",
      "departmentNumber": "2",
      "isActive": true,
      "managerIds": [],
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves departments.

HTTP Request

GET https://app.seventime.se/api/2/departments

Query Parameters

E.g. https://app.seventime.se/api/2/departments/?

Parameter Default Description
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Department

curl "https://app.seventime.se/api/2/departments/59d05abdc471b72e4979135" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/departments/59d05abdc471b72e4979135";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "managerIds": [],
    "_id": "59d05abdc471b72e4979135",
    "name": "Utveckling",
    "departmentNumber": "2",
    "isActive": true,
  }
}

This endpoint retrieves a specific department.

HTTP Request

GET https://app.seventime.se/api/2/departments/<_id>

URL Parameters

Parameter Description
_id The _id of the department to retrieve

Distributors

Get Distributors

curl "https://app.seventime.se/api/2/distributors/?limit=5&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/distributors/?limit=5&page=1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 16,
    "totalPages": 4,
    "currentPage": 3
  },
  "data": [
    {
      "_id": "5f6b2e6af24d5df526848",
      "name": "UE lev 20200923",
      "distributorNumber": "20",
      "address": "",
      "zipCode": "",
      "city": "",
      "country": "",
      "phone": "",
      "email": "",
      "organizationNumber": "",
      "notes": "",
      "purchaseOrderEmail": "",
      "ourCustomerNumber": "",
      "paymentDays": 30,
      "hasSelfBilling": true,
      "selfBillingSettings": {
        "invoiceDeduction": 5,
        "deductionExpenseItem": "5e74bf0917ae9b91662484d",
        "invoiceNumberSeries": "UELEV23",
        "invoiceCounter": 1,
        "emailForSelfBilling": "email@company.com"
      },
      "isActive": true,
      "isSubContractor": true,
      "createdDate": "2020-09-23T13:19:42.450Z",
      "modifiedDate": "2020-09-23T13:19:42.450Z"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves distributors.

HTTP Request

GET https://app.seventime.se/api/2/distributors

Query Parameters

Parameter Default Description
name If specified, distributors that match the parameter will be included.
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Distributor

curl "https://app.seventime.se/api/2/distributors/5f6b2e6af24d5d7121b" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/distributors/5f6b2e6af24d5d7121b";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "selfBillingSettings": {
      "invoiceDeduction": 5,
      "deductionExpenseItem": "5e74bf0917ae9b9166154952d",
      "invoiceNumberSeries": "UELEV23",
      "invoiceCounter": 1,
      "emailForSelfBilling": "email@company.com"
    },
    "_id": "5f6b2e6af24d5d7121b",
    "name": "UE lev 20200923",
    "distributorNumber": "20",
    "address": "",
    "zipCode": "",
    "city": "",
    "country": "",
    "phone": "",
    "email": "",
    "organizationNumber": "",
    "notes": "",
    "purchaseOrderEmail": "",
    "ourCustomerNumber": "",
    "paymentDays": 30,
    "hasSelfBilling": true,
    "isActive": true,
    "isSubContractor": true,
    "createdDate": "2020-09-23T13:19:42.450Z",
    "modifiedDate": "2020-09-23T13:19:42.450Z"
  }
}

This endpoint retrieves a specific distributor.

HTTP Request

GET https://app.seventime.se/api/2/distributors/<_id>

URL Parameters

Parameter Description
_id The _id of the distributor to retrieve

Get Distributor Contact Persons

curl "https://app.seventime.se/api/2/distributorContactPersons/?distributor=5f6b2e6af24d5d7121b" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/distributorContactPersons/?distributor=5f6b2e6af24d5d7121b";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "_id": "5fca23df0317c151d15459",
      "name": "Kontaktperson 1",
      "title": "",
      "workPhone": "",
      "cellPhone": "",
      "email": "",
      "distributor": "5f6b2e6af24d5d7121b",
      "distributorName": "UE lev 20200923",
      "mainContact": false,
      "isActive": true,
      "createdDate": "2020-12-04T10:13:03.965Z",
      "modifiedDate": "2020-12-04T10:13:03.965Z"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves distributor contact persons.

HTTP Request

GET https://app.seventime.se/api/2/distributorContactPersons/?distributor=5f6b2e6af24d5d7121b

Query Parameters

Parameter Default Description
distributor Id of the distributor. This field must be included
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Create a Distributor

curl -X POST "https://app.seventime.se/api/2/distributors/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"name":"DistributorName"}'
let jsonData = {
  name: 'DistributorName'
};

let options = {
  url: 'https://app.seventime.se/api/2/distributors',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.post(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
  } else {
    console.error("ERROR! Unable to distributor: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{
  "_id": '62f3a242ca38bbsce075249',
  "name": 'Distributor Test',
  "distributorNumber": '123456',
  "address": 'test 1',
  "zipCode": '12345',
  "city": 'BĂ¥stad',
  "country": 'SE',
  "phone": '0412412412',
  "email": '132312kewkewa',
  "organizationNumber": '12345688',
  "vatNumber": '90',
  "bankgiro": 'eeee',
  "plusgiro": 'bbbbb',
  "notes": 'testartestar testar',
  "purchaseOrderEmail": 'test@testing.com',
  "ourCustomerNumber": '031239',
  "paymentDays": 45,
  "isSubContractor": true,
  "hasSelfBilling": true,
  "selfBillingSettings": {
    "invoiceDeduction": 10,
    "invoiceNumberSeries": 'SE',
    "invoiceCounter": 12,
    "emailForSelfBilling": 'llllllll'
  },
  "isActive": false,
  "createdDate": '2022-08-10T12:49:26.716Z',
  "modifiedDate": '2022-08-10T12:49:26.718Z',
  "documents": [],
  __v: 0
}

This endpoint creates a distributor

HTTP Request

POST https://app.seventime.se/api/2/distributors/

POST Parameters

Parameter Type Required? Description
name String Yes Name of the distributor
distributorNumber String No Distributor number
address String No Address of the distributor
zipCode String No Zip code of the distributor
city String No City of the distributor
country String No Country of the distributor
email Number No Email of the distributor
organizationNumber String No Organization number for the distributor
vatNumber String No VAT number for the distributor
bankgiro String No Bankgiro for distributor
plusgiro String No Plusgiro for distributor
notes String No Notes
purchaseOrderEmail String No The purchase order email
ourCustomerNumber String No Your customer number for the distributor
paymentDays Number No Number of payment days
isSubContractor Boolean No Is it a sub contractor?
hasSelfBilling Boolean No Should the distributor have self billing?
selfBillingSettings Array No Array containing information about self billing. See below for more details.
isActive Boolean No Should the distributor be active?

Attributes for selfBillingSettings

Parameter Type Required? Description
invoiceDeduction String No Invoice deduction
invoiceNumberSeries String No Invoice number series
invoiceCounter String No Invoice counter
emailForSelfBilling String No Email for self billing

Update a Distributor

curl -X PUT "https://app.seventime.se/api/2/distributors/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"62f3a242ca38bbsce075249",name:"New distributor name"}'
let jsonData = {
  _id: '5fbcfe75ba9312280e2145897521',
  name: 'New distributor name'
};

let options = {
  url: 'https://app.seventime.se/api/2/distributors',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.put(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Distributor updated: _id: " + body._id);
  } else {
    console.error("ERROR! Unable to distributor: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{
  "_id": '62f3a242ca38bbsce075249',
  "name": 'New distributor name',
  "distributorNumber": '123456',
  "address": 'test 1',
  "zipCode": '12345',
  "city": 'BĂ¥stad',
  "country": 'SE',
  "phone": '0412412412',
  "email": '132312kewkewa',
  "organizationNumber": '12345688',
  "vatNumber": '90',
  "bankgiro": 'eeee',
  "plusgiro": 'bbbbb',
  "notes": 'testartestar testar',
  "purchaseOrderEmail": 'test@testing.com',
  "ourCustomerNumber": '031239',
  "paymentDays": 45,
  "isSubContractor": true,
  "hasSelfBilling": true,
  "selfBillingSettings": {
    "invoiceDeduction": 10,
    "invoiceNumberSeries": 'SE',
    "invoiceCounter": 12,
    "emailForSelfBilling": 'llllllll'
  },
  "isActive": false,
  "createdDate": '2022-08-10T12:49:26.716Z',
  "modifiedDate": '2022-08-10T12:49:26.718Z',
  "documents": [],
  __v: 0
}
"Distributor updated: _id: 62f3a242ca38bbsce075249"

This endpoint updates a distributor

HTTP Request

PUT https://app.seventime.se/api/2/distributors/

PUT Parameters

The table below shows the required fields. Other available fields can be found in the section 'Create a Time Log'.

Parameter Type Required? Description
_id String Yes Id of the distributor

Documents

Get Documents

Documents are included when fetching other objects, e.g. work orders or projects. They are found in an array named documents. The objects in the array contain a path which can be used to download the documents. Folders are also included and will have the flag isFolder as true.

Fetching a work order returns a documents array like this:

{
  "data": {
    //...
    "documents": [
      { 
        "createDate": "2021-08-24T11:40:16.285Z",
        "modifiedDate": "2021-08-24T11:40:16.285Z",
        "_id": "6124daa00c1532914b92",
        "name": "plan1.pdf",
        "path": "https://seventimedev.s3-eu-west-1.amazonaws.com/...",
        "contentType": "application/pdf",
        "size": 20548,
        "user": "571f61330c7f498a2d5812",
        "userName": "Anna Andersson",
        "isLink": false,
        "isFolder": false,
        "folderId": "6124d18c910273b259cf819",
        "isPublic": false,
      },
    ],
    //..
  }
}

Upload a document

curl -X POST "https://app.seventime.se/api/2/documents/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"uploadedBy":"571f61330c7f498a2d5812","entityId":"5bae34dca878b5497748","entityType":"200","file":"{fileContent: data, options: {fileName: plan2.pdf, contentType: application/pdf}}","folderId":"null"}'
let jsonData = {
  uploadedBy: '571f61330c7f498a2d5812',
  entityId: "5bae34dca878b5497748",
  entityType: 200,
  file: {
      fileContent: data,
      options: {
          fileName: 'plan2.pdf',
          contentType: 'application/pdf'
      }
  },
  folderId: null,
};

let options = {
  url: 'https://app.seventime.se/api/2/documents',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.post(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log('File uploaded');
  } else {
    console.error("ERROR! Unable to upload document: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{
  success: true
}

This endpoint uploads a document or adds a folder.

HTTP Request

POST https://app.seventime.se/api/2/documents/

POST Parameters

Parameter Type Required? Description
uploadedBy String Yes Id of the user who uploaded the file
entityId String Yes* Id of the parent object, e.g. id of a work order.
entityType Number Yes* Entity type of the parent. See table below for available types and corresponding code.
file Object Yes Object containing the file and information about the file. See below for more details
folderId String Yes Folder id in which the document will be placed in

*Not Required for folders

Available entity types for parent object

Code Entity type
200 Work order
400 Invoice
500 Project
600 Expense
1100 Customer
1400 Quote
1500 Machine
1600 Object item
1800 Supplement order
2300 Purchase order
2400 Education log
3100 Deviation
3200 Machine log
3300 Supplier invoice

What the file object should contain

Parameter Type Required? Description
fileContent String Yes* The file content should be included here encoded as base64.
options Object Yes Options for the file. This object should contain fileName and contentType
fileName String Yes Name of the file in Seven Time. This does not need to be the same as the local file
contentType String Yes* Content or MIME type of the file.

*Not Required for folders

Driver Journals

Get Driver Journals

curl "https://app.seventime.se/api/2/driverJournals/?limit=5&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/driverJournals/?limit=5&page=1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 87,
    "totalPages": 18,
    "currentPage": 2
  },
  "data": [
    {
      "_id": "5613c0eabed82c732b54312",
      "name": "",
      "driverJournalItemType": "574ed84219e78125333213578b",
      "driverJournalItemTypeName": "4 kr/km",
      "car": null,
      "carRegistrationNumber": "ABC123",
      "description": "",
      "user": "5f48eb3e65d7eeb491836d",
      "userName": "Anna Andersson",
      "customer": "5bb26376c42fb9929932161",
      "customerName": "Company AB",
      "project": "5f924f4f533f103176210",
      "projectName": "Tester",
      "workOrder": "5bae34dca878bd7d0182b",
      "workOrderTitle": "20160525",
      "workOrderNumber": 1181,
      "startAddress": "Ă–stra Gatan 129, Stockholm",
      "endAddress": "Västra Gatan 921, Stockholm",
      "travelPurpose": ".",
      "startOdometer": 156,
      "endOdometer": 178,
      "totalDistance": 22,
      "price": 4,
      "totalAmount": 88,
      "isInvoiced": true,
      "invoice": "5fab29b038bd33301751",
      "modifiedDate": "2016-06-17T09:29:01.958Z",
      "createDate": "2016-06-17T09:20:46.845Z",
      "isInvoiceable": true,
      "timestamp": "2016-06-17T09:20:10.254Z"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves driver journals.

HTTP Request

GET https://app.seventime.se/api/2/driverJournals

Query Parameters

Parameter Default Description
projectName If specified, driver journals that match the parameter will be included.
customerName If specified, driver journals that match the parameter will be included.
driverJournalItemTypeName If specified, driver journals that match the parameter will be included.
isInvoiceable If specified, driver journals that match the parameter will be included.
workOrderTitle If specified, driver journals that match the parameter will be included.
workOrderNumber If specified, driver journals that match the parameter will be included.
carRegistrationNumber If specified, driver journals that match the parameter will be included.
startAddress If specified, driver journals that match the parameter will be included.
endAddress If specified, driver journals that match the parameter will be included.
fromDate If specified, driver journals registered after or on this date will be included. The date has to be in the format 'YYYY-MM-DD'
toDate If specified, driver journals registered before or on this date will be included. The date has to be in the format 'YYYY-MM-DD'
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Driver Journal

curl "https://app.seventime.se/api/2/driverJournals/5613c0eabed93172591b" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/driverJournals/5613c0eabed93172591b";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "isInvoiceable": true,
    "_id": "5613c0eabed93172591b",
    "name": "",
    "driverJournalItemType": "574ed84219e78125333201799",
    "driverJournalItemTypeName": "4 kr/km",
    "car": null,
    "carRegistrationNumber": "ABC123",
    "description": "",
    "user": "5f48eb3e65d7ee40317245d",
    "userName": "Anna Andersson",
    "customer": "5bb26376c42e07412b55",
    "customerName": "Company AB",
    "project": "5f924f4f533f102af784581",
    "projectName": "Tester",
    "workOrder": "5bae34dca878b237942",
    "workOrderTitle": "20160525",
    "workOrderNumber": 1181,
    "startAddress": "Ă–stra Gatan 129, Stockholm",
    "endAddress": "Västra Gatan 921, Stockholm",
    "travelPurpose": ".",
    "startOdometer": 156,
    "endOdometer": 178,
    "totalDistance": 22,
    "price": 4,
    "totalAmount": 88,
    "isInvoiced": true,
    "invoice": "5fab29b0386134897",
    "modifiedDate": "2016-06-17T09:29:01.958Z",
    "createDate": "2016-06-17T09:20:46.845Z",
    "timestamp": "2016-06-17T09:20:10.254Z",
  }
}

This endpoint retrieves a specific driver journal.

HTTP Request

GET https://app.seventime.se/api/2/driverJournals/<_id>

URL Parameters

Parameter Description
_id The _id of the driver journal to retrieve

Get Driver Journals Types

curl "https://app.seventime.se/api/2/driverJournalTypes" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/driverJournalTypes";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "_id": "5e5ef41f03481b466",
      "name": "Diesel - ej skt.fri",
      "articleNumber": "45",
      "cost": 0.5,
      "price": 0.65,
      "isInvoiceable": true,
      "isDefault": false,
      "salaryCompensationType": 20,
      "salaryType": "5e5cd96da2f5b64823791",
      "salaryTypeName": "Milersättning för diesel",
      "createDate": "2020-03-03T09:14:11.750Z",
      "isActive": true,
      "salaryCode": "9172"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves driver journals types.

HTTP Request

GET https://app.seventime.se/api/2/driverJournalTypes

Query Parameters

Parameter Default Description
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Create a Driver Journal

curl -X POST "https://app.seventime.se/api/2/driverJournals/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"createdByUser":"5120314650548666171","user":"51203178219463791","expenseItem":"5de78aed13437891254"}'
let jsonData = {
  createdByUser: '512031465648817e55b',
  user: '5f48eb3e65d7e5489134452',
  carRegistrationNumber: 'ABC123',
  driverJournalItemType: '5e5ef4124135975',
  startAddress: 'Address start, Stockholm',
  endAddress: 'Address end, Stockholm',
  travelPurpose: 'Delivery',
  startOdometer: '45',
  endOdometer: '60',
};

let options = {
  url: 'https://app.seventime.se/api/2/driverJournals',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.post(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Driver journal created: _id: " + body._id);

  } else {
    console.error("ERROR! Unable to create driver journal: " + error);
  }
});

The above command returns JSON structured like this:

{
  "isInvoiceable": true,
  "_id": "5fc619b964579133",
  "timestamp": "2020-12-01T10:23:53.370Z",
  "createDate": "2020-12-01T10:23:53.370Z",
  "modifiedDate": "2020-12-01T10:23:53.370Z",
  "user": "5f48eb3e65d7ee457951b",
  "userName": "Anna Andersson",
  "carRegistrationNumber": "ABC123",
  "driverJournalItemType": "5e5ef41f0d5481125",
  "driverJournalItemTypeName": "Diesel - ej skt.fri",
  "startAddress": "Address start, Stockholm",
  "endAddress": "Address end, Stockholm",
  "travelPurpose": "Delivery",
  "startOdometer": 45,
  "endOdometer": 60,
  "totalDistance": 15,
  "isSalaryCompensated": false,
  "price": 0,
  "totalAmount": 0,
  "cost": 0,
  "totalCost": 0,
}
"Driver journal created: _id: 5fc619b9625789154"

This endpoint creates a driver journal

HTTP Request

POST https://app.seventime.se/api/2/driverJournals/

POST Parameters

Parameter Type Required? Description
createdByUser String Yes Id of the user who created the driver journal
user String Yes Id of the user on the driver journal
vehicle String Yes* Id of the vehicle. *Required if carRegistrationNumber is not specified
carRegistrationNumber String Yes* Car registration number. *Required if vehicle is not specified. This will not be used if vehicle is specified
driverJournalItemType String Yes Type of trip
startAddress String Yes Start address of the driver journal
endAddress String Yes End address of the driver journal
travelPurpose String Yes Errand/position/Company/Contact person
startOdometer Number Yes Odometer reading at the start
endOdometer Number Yes Odometer reading at the end
customer String No Id of the customer
project String No Id of the project
workOrder String No Id of the work order. If project is specified, the work order must belong to the project. The customer from the work order will be used on the driver journal
price Number No Price/km
cost Number No Cost/km
description String No Description or notes on the driver journal
isInvoiceable Boolean No Is the driver jounal invoiceable?
isSalaryCompensated Boolean No Is the driver jounal salary compensated?

Update a Driver Journal

curl -X PUT "https://app.seventime.se/api/2/driverJournals/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"5fc619b96294498231","modifiedByUser":"51203146506d96498312567","user":"5f48eb3e65d7ee44598912b"}'
let jsonData = {
  _id: '5fc619b96294735fc7812458',
  modifiedByUser: '51203146506d94891377',
  user: '5f48eb3e65d7ee461288'
};

let options = {
  url: 'https://app.seventime.se/api/2/driverJournals',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.put(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Driver journal updated: _id: " + body._id);
  } else {
    console.error("ERROR! Unable to update driver journal: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{
  "isInvoiceable": true,
  "_id": "5fc619b96294735124544bd",
  "timestamp": "2020-12-01T10:23:53.370Z",
  "createDate": "2020-12-01T10:23:53.370Z",
  "modifiedDate": "2020-12-01T10:23:53.370Z",
  "user": "5f48eb3e65d7e2548412d",
  "userName": "Anna Andersson",
  "carRegistrationNumber": "ABC123",
  "driverJournalItemType": "5e5ef41f0d989125e",
  "driverJournalItemTypeName": "Diesel - ej skt.fri",
  "startAddress": "Address start, Stockholm",
  "endAddress": "Address end, Stockholm",
  "travelPurpose": "Delivery",
  "startOdometer": 45,
  "endOdometer": 60,
  "totalDistance": 15,
  "isSalaryCompensated": false,
  "price": 0,
  "totalAmount": 0,
  "cost": 0,
  "totalCost": 0
}
"Driver journal updated: _id: 5fc619b96294735124544bd"

This endpoint updates a driver journal

HTTP Request

PUT https://app.seventime.se/api/2/driverJournals/

PUT Parameters

The table below shows the required fields. Other available fields can be found in the section 'Create a Driver Journal'.

Parameter Type Required? Description
_id String Yes Id of the driver journal
modifiedByUser String Yes Id of the user who made the change
user String Yes Id of the user on the driver journal

Delete a Driver Journal

curl -X DELETE "https://app.seventime.se/api/2/driverJournals/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"5fc619b96294735fd458173","deletedByUser":"51203146506d961c1349691"}'
let jsonData = {
  _id: '5fc619b96294735315489',
  deletedByUser: '51203146506d9611b895'
};

let options = {
  url: 'https://app.seventime.se/api/2/driverJournals',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.delete(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Driver journal deleted: _id: " + body._id);
  } else {
    console.error("ERROR! Unable to delete driver journal: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{
  "_id": "5fc619b96294735fc421d77a",
}
"Driver journal deleted: _id: 5fc619b962947312234894"

This endpoint deletes a driver journal

HTTP Request

DELETE https://app.seventime.se/api/2/driverJournals/

DELETE Parameters

Parameter Type Required? Description
_id String Yes Id of the driver journal

Expenses

Get Expenses

curl "https://app.seventime.se/api/2/expenses/?limit=2&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/expenses/?limit=2&page=1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 622,
    "totalPages": 311,
    "currentPage": 3
  },
  "data": [
    {
      "_id": "53ad291839f16d23a6448412b",
      "attestedBy": null,
      "createDate": "2014-06-27T08:11:15.954Z",
      "customer": null,
      "customerName": "",
      "description": "",
      "documents": [],
      "expenseItem": "52d92f32d5fcf8949842b",
      "isAttested": false,
      "isInvoiceable": true,
      "isInvoiced": false,
      "name": "Arbetsordermodul2",
      "numberOfItems": 1,
      "project": "516fad2b265135db7801542b",
      "projectName": "Glimminge",
      "supplementOrder": false,
      "timestamp": "2014-06-27T00:00:00.000Z",
      "totalAmount": 20,
      "totalAmountAfterDiscount": 20,
      "totalAmountInclTax": 25,
      "totalTaxAmount": 5,
      "unit": "st",
      "unitCost": 20,
      "unitPrice": 20,
      "unitPriceInclTax": 25,
      "unitTax": 5,
      "user": "51203146506d9615189d125",
      "userName": "Anna Andersson",
      "workOrder": null,
      "workOrderNumber": 0,
      "workOrderTitle": "",
      "unitPriceAfterDiscount": 20,
      "discountPercent": 0,
      "unitTaxPercent": 25,
      "doReimburse": false,
      "salaryCompilation": null,
      "verificationNumber": "",
      "distributor": null,
      "distributorName": "",
      "totalCost": 20,
      "articleNumber": "208"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves expenses.

HTTP Request

GET https://app.seventime.se/api/2/expenses

Query Parameters

Parameter Default Description
name If specified, expenses that match the parameter will be included.
articleNumber If specified, expenses that match the parameter will be included.
customer If specified, expenses that match the parameter will be included.
project If specified, expenses that match the parameter will be included.
distributor If specified, expenses that match the parameter will be included.
fromDate If specified, expenses registered after or on this date will be included. The date has to be in the format 'YYYY-MM-DD'
toDate If specified, expenses registered before or on this date will be included. The date has to be in the format 'YYYY-MM-DD'
lastModified If specified, expenses that has been modified since the specified timestamp will be included. Accepted formats: 'YYYY-MM-HH HH:MM', 'YYYY-MM-HH HH:MM:SS', 'YYYY-MM-HHTHH:MM', 'YYYY-MM-HHTHH:MM:SS'
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Expense

curl "https://app.seventime.se/api/2/expenses/53ad291839f16d23a79348b" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/expenses/53ad291839f16d23a79348b";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "_id": "53ad291839f16d23a61549135d",
    "attestedBy": null,
    "createDate": "2014-06-27T08:11:15.954Z",
    "customer": null,
    "customerName": "",
    "description": "",
    "documents": [],
    "expenseItem": "52d92f32d5fc8988645588d",
    "isAttested": false,
    "isInvoiceable": true,
    "isInvoiced": false,
    "name": "Arbetsordermodul2",
    "numberOfItems": 1,
    "project": "516fad2b265135db7803154d",
    "projectName": "Glimminge",
    "supplementOrder": false,
    "timestamp": "2014-06-27T00:00:00.000Z",
    "totalAmount": 20,
    "totalAmountAfterDiscount": 20,
    "totalAmountInclTax": 25,
    "totalTaxAmount": 5,
    "unit": "st",
    "unitCost": 20,
    "unitPrice": 20,
    "unitPriceInclTax": 25,
    "unitTax": 5,
    "user": "51203146506d961c0e1248a25",
    "userName": "Anna Andersson",
    "workOrder": null,
    "workOrderNumber": 0,
    "workOrderTitle": "",
    "unitPriceAfterDiscount": 20,
    "discountPercent": 0,
    "unitTaxPercent": 25,
    "doReimburse": false,
    "salaryCompilation": null,
    "verificationNumber": "",
    "distributor": null,
    "distributorName": "",
    "totalCost": 20,
    "articleNumber": "208"
  }
}

This endpoint retrieves a specific expense.

HTTP Request

GET https://app.seventime.se/api/2/expenses/<_id>

URL Parameters

Parameter Description
_id The _id of the expense to retrieve

Get Expenses Items

curl "https://app.seventime.se/api/2/expenseItems/?limit=10&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/expenseItems/?limit=10&page=1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 19478,
    "totalPages": 1948,
    "currentPage": 176
  },
  "data": [
    {
      "_id": "5de78aed133271919648552",
      "description": "",
      "tax": 25,
      "articleNumber": "601310",
      "name": "10-pack Reaktionsbollar",
      "unitPrice": 295.59,
      "unitCost": 221,
      "unit": "St",
      "isInvoiceable": true,
      "isCategory": false,
      "parentExpenseItem": null,
      "parentExpenseItemName": "",
      "createDate": "2019-12-04T10:31:06.603Z",
      "bundledArticles": [],
      "alwaysReimburse": false,
      "isActive": true,
      "categoryGroupNumber": "",
      "articleGroupNumber": "",
      "distributor": null,
      "distributorName": "",
      "isInventoryItem": false,
      "unitPriceInclTax": 369.48749999999995
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves expense items.

HTTP Request

GET https://app.seventime.se/api/2/expenses

Query Parameters

Parameter Default Description
name If specified, expense items that match the parameter will be included.
articleNumber If specified, expense items that match the parameter will be included.
distributorName If specified, expense items that match the parameter will be included.
description If specified, expense items that match the parameter will be included.
parentExpenseItemName If specified, expense items that match the parameter will be included.
isInvoiceable If specified, expense items that match the parameter will be included.
isActive If specified, expense items that match the parameter will be included.
favorite If specified, expense items that match the parameter will be included.
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Expense Item

curl "https://app.seventime.se/api/2/expenseItems/5de78aed1332719192366458" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/expenseItems/5de78aed1332719192366458";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "_id": "5de78aed1332719192366458",
    "description": "",
    "tax": 25,
    "articleNumber": "601310",
    "name": "10-pack Reaktionsbollar",
    "unitPrice": 295.59,
    "unitCost": 221,
    "unit": "St",
    "isInvoiceable": true,
    "isCategory": false,
    "parentExpenseItem": null,
    "parentExpenseItemName": "",
    "createDate": "2019-12-04T10:31:06.603Z",
    "bundledArticles": [],
    "alwaysReimburse": false,
    "isActive": true,
    "categoryGroupNumber": "",
    "articleGroupNumber": "",
    "distributor": null,
    "distributorName": "",
    "isInventoryItem": false,
    "unitPriceInclTax": 369.48749999999995
  }
}

This endpoint retrieves a specific expense item.

HTTP Request

GET https://app.seventime.se/api/2/expenseItems/<_id>

URL Parameters

Parameter Description
_id The _id of the expense item to retrieve

Create an Expense

curl -X POST "https://app.seventime.se/api/2/expenses/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"createdByUser":"5f48eb3e65d7ee49452154","user":"51203146506d961c0219865121","expenseItem":"5de78aed1332719192366458"}'
let jsonData = {
  createdByUser: '5f48eb3e65d7ee49452154',
  user: '51203146506d961c0219865121',
  expenseItem: '5de78aed1332719192366458'
};

let options = {
  url: 'https://app.seventime.se/api/2/expenses',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.post(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Expense created: _id: " + body._id);
  } else {
    console.error("ERROR! Unable to create expense: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
  "isInvoiceable": true,
  "_id": "5fbe6844166256521851",
  "timestamp": "2020-11-25T14:20:52.129Z",
  "documents": [],
  "createDate": "2020-11-25T14:20:52.129Z",
  "bundledArticles": [],
  "customFields": [],
  "numberOfItems": 1,
  "user": "51203146506d961c0219865121",
  "userName": "Anna Andersson",
  "expenseItem": "5de78aed1332719192366458",
  "articleNumber": "575733",
  "name": "10-pack Reaktionsbollar",
  "description": "Skivhantel av järn",
  "distributor": "573c52cdf609f5692351914b",
  "distributorName": "Lev 4",
  "unit": "St",
  "unitCost": 319,
  "unitTaxPercent": 25,
  "unitPrice": 426.66,
  "unitPriceAfterDiscount": 426.66,
  "discountPercent": 0,
  "unitTax": 106.665,
  "unitPriceInclTax": 533.325,
  "totalTaxAmount": 106.665,
  "totalAmount": 426.66,
  "totalAmountAfterDiscount": 426.66,
  "totalCost": 319,
}
"Expense created: _id: 5fbe6844166256521851"

This endpoint creates an expense

HTTP Request

POST https://app.seventime.se/api/2/expenses/

POST Parameters

Parameter Type Required? Description
createdByUser String Yes Id of the user who created the expense
user String Yes Id of the user on the expense
expenseItem String Yes* Id of the expense item. *Required if freetext for articles is not activated
name String Yes* Name of the article. *Required if expenseItem is not specified. This will set the article to freetext and is only possible if the setting for this is enabled.
workOrder String No Id of the work order
customer String No Id of the customer. If workOrder is specified, the customer from the work order will be used
project String No Id of the project. If workOrder is specified, the project from the work order will be used
distributor String No Id of the distributor
numberOfItems String No Number of items
unit String No Unit of the number of items
unitCost Number No* Cost per unit. If not specified, the cost on the expense item will be used. *Required if expenseItem is not specified
unitPrice Number No* Price per unit. If not specified, the price from the price list set on the customer will be used. If no price list is set, the price will be calculated from the cost and the 'Mark up on purchase price' on the customer. If 'Mark up on purchase price' is 0, the price will be set to the expense item price. *Required if expenseItem is not specified
discountPercent Number No* Discount percent on the unit price. *Required if expenseItem is not specified
taxPercent Number No* Tax percent on the unit price. *Required if expenseItem is not specified
timestamp String No Time stamp of expense
description String No Description of the expense
isInvoiceable Boolean No Is the expense invoiceable?
doReimburse Boolean No Is the expense an own expense?

Update an Expense

curl -X PUT "https://app.seventime.se/api/2/expenses/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"5fbe684416625651d3476852","modifiedByUser":"5f48eb3e612421554796edb","user":"51203146506d961c030689135"}'
let jsonData = {
  _id: '5fbe684416625651d3476852',
  modifiedByUser: '5f48eb3e612421554796edb',
  user: '51203146506d961c030689135'
};

let options = {
  url: 'https://app.seventime.se/api/2/expenses',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.put(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Expense updated: _id: " + body._id);
  } else {
    console.error("ERROR! Unable to update expense: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
  "isInvoiceable": true,
  "_id": "5fbe684416625651d3476852",
  "timestamp": "2020-11-25T14:20:52.129Z",
  "documents": [],
  "createDate": "2020-11-25T14:20:52.129Z",
  "bundledArticles": [],
  "customFields": [],
  "numberOfItems": 1,
  "user": "51203146506d961c030689135",
  "userName": "Anna Andersson",
  "expenseItem": "5de78aed1332719192362bed",
  "articleNumber": "575733",
  "name": "10-pack Reaktionsbollar",
  "description": "Skivhantel av järn",
  "distributor": "573c52cdf609f5664789528",
  "distributorName": "Lev 4",
  "unit": "St",
  "unitCost": 319,
  "unitTaxPercent": 25,
  "unitPrice": 426.66,
  "unitPriceAfterDiscount": 426.66,
  "discountPercent": 0,
  "unitTax": 106.665,
  "unitPriceInclTax": 533.325,
  "totalTaxAmount": 106.665,
  "totalAmount": 426.66,
  "totalAmountAfterDiscount": 426.66,
  "totalCost": 319,
}
"Expense updated: _id: 5fbe684416625651d7f43257"

This endpoint updates an expense

HTTP Request

PUT https://app.seventime.se/api/2/expenses/

PUT Parameters

The table below shows the required fields. Other available fields can be found in the section 'Create an Expense'.

Parameter Type Required? Description
_id String Yes Id of the expense
modifiedByUser String Yes Id of the user who made the change
user String Yes Id of the user on the expense

Delete an Expense

curl -X DELETE "https://app.seventime.se/api/2/expenses/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"5fbe6844166256479138667","deletedByUser":"51203146506d96457793165"}'
let jsonData = {
  _id: "5fbe6844166256479138667",
  deletedByUser: '51203146506d96457793165'
};

let options = {
  url: 'https://app.seventime.se/api/2/expenses',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.delete(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Expense deleted: _id: " + body._id);
  } else {
    console.error("ERROR! Unable to delete expense: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
  "_id": "5fbe6844166256479138667"
}
"Expense deleted: _id: 5fbe6844166256479138667"

This endpoint deletes an expense

HTTP Request

DELETE https://app.seventime.se/api/2/expenses/

DELETE Parameters

Parameter Type Required? Description
_id String Yes Id of the expense
deletedByUser String Yes Id of the user who deleted the expense

Invoices

Get Invoices

curl "https://app.seventime.se/api/2/invoices/?limit=3&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/invoices/?limit=3&page=1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 1987,
    "totalPages": 663,
    "currentPage": 9
  },
  "data": [
    {
      "_id": "5fab29b038bd334ab5402446",
      "deliveryAddress": {
        "name": "Kontoret",
        "address": "Ă–stra Gatan 129",
        "address2": "Västra Gatan 921",
        "zipCode": "12345",
        "city": "Stockholm",
        "country": "SE",
        "phone": "1234-567890"
      },
      "houseProperties": {
        "typeOfProperty": 1,
        "propertyDescription": "property description",
        "housingSocietyNumber": "",
        "apartmentNumber": "",
        "maxDeductionAmount": 100000,
        "personalNumber": "",
        "deductionDistribution": [
          {
            "_id": "5fae99b072aa334cb533648",
            "userName": "testUser",
            "personalNumber": "12345",
            "distributionPercent": 40
          },
          {
            // ...
          }
        ]
      },
      "workOrderIds": [
        "5fa2b550c289ea61785952",
        // ...
      ],
      "tags": [
        "5f742440d608b220152b1549",
        "5f74243ad608b22058126b12"
      ],
      "createDate": "2020-11-13T14:35:28.797Z",
      "invoiceItems": [
        {
          "_id": "5fae99b072aa334cb52449682",
          "createDate": "2020-11-13T14:35:28.795Z",
          "houseWorkTypeOfWork": 1,
          "name": "**Skivhantel i Gummi 10 Kg****",
          "description": "Skivhantel av järn",
          "expenseItem": "5de78ae9bb1356246889512",
          "expenseItemName": "**Skivhantel i Gummi 10 Kg****",
          "itemType": "expense",
          "numberOfItems": 1,
          "unit": "St",
          "unitCost": 319,
          "totalCost": 319,
          "discountPercent": 0,
          "taxPercent": 0,
          "unitPrice": 12345,
          "totalAmount": 12345,
          "totalTaxAmount": 0,
          "totalAmountInclTax": 12345,
          "itemId": "0.9281811863461673",
          "itemOrder": 1024,
          "houseWorkFlag": true
        },
        {
          // ...
        }
      ],
      "invoiceLogEntries": [
        {
          "_id": "5fae99b072aa3667942258",
          "logDate": "2020-11-13T14:35:28.797Z",
          "logType": 1,
          "description": "",
          "user": "51714655fbb708f54975368",
          "userName": "Anna Andersson",
          "additionalData": ""
        },
        {
          // ...
        }
      ],
      "invoiceName": "Invoice",
      "marking": "marking",
      "yourOrderNumber": "12345",
      "notes": "invoice notes",
      "taxPercent": 12,
      "invoiceStatus": 2,
      "invoiceDate": "2020-11-04T23:00:00.000Z",
      "createdByUser": "51714655fbb708f37966632571",
      "createdByUserName": "Anna Andersson",
      "customer": "5cc05b6a4e595e68466411b",
      "customerName": "Company AB",
      "dueDate": "2020-12-04T23:00:00.000Z",
      "language": "EN",
      "project": "5b20cce1d59a902e28489125b",
      "projectName": "BlĂ¥sippan",
      "contactPerson": "5af95e6b1e557892234",
      "contactPersonName": "Anna Andersson",
      "ourReference": "518ff209d5a658451412",
      "ourReferenceName": "Anna Andersson",
      "workOrder": "5fa2b550c289ea96544921",
      "workOrderNumber": "4843",
      "invoiceType": 1,
      "resultUnit": "5784ff52fc71ce243b889d22482",
      "resultUnitName": "Kontor Nord",
      "priceList": "57bc187159a73f31230b5186472d25",
      "priceListName": "Kundlista Inkl moms",
      "multipleTaxesOnRows": true,
      "currencyCode": "SEK",
      "totalAmount": 16549,
      "totalTaxAmount": 327.24,
      "totalAmountInclTax": 16876,
      "totalAmountRounding": -0.24,
      "sentDate": "2020-11-13T14:35:28.798Z",
      "invoiceNumber": "24481",
      "OCRNumber": "2448173",
      "archived": false,
      "archivedDate": null,
      "creditForInvoice": null,
      "creditForInvoiceNumber": "",
      "creditInvoice": null,
      "creditInvoiceNumber": "",
      "currencyRate": 1,
      "customerAddress": "Ă–stra Gatan 129<br>123 45 Stockholm",
      "customerEmail": "email@company.com",
      "customerNumber": "3028",
      "customerOrgNo": "",
      "customerVAT": "",
      "description": null,
      "discountInPercent": 0,
      "exportedToEconomy": false,
      "footerInfoText": null,
      "footerText": "<table width=\"100%\"><tr><td style='vertical-align: top;'><div><div><span style=\"font-size: 11px;\"></span></div></div></td><td style='vertical-align: top;'><div><span style=\"font-size: 11px;\">Efter förfallodagen debiteras dröjsmĂ¥lsränta: 13.0%</span></div><div><br></div></td><td style='vertical-align: top;'><span style=\"font-size: 11px;\">Ă„ganderättsförbehĂ¥ll tills full likvid erlagts</span><span style=\"font-size: 11px;\">.</span><br></td><td style='vertical-align: top;'><div><span style=\"font-size: 11px;\">Godkänd för F-skatt</span></div><div><br></div></td></tr></table>",
      "headerText": null,
      "houseDeductionAmount": 0,
      "houseDeductionBasisAmount": 0,
      "isCreditInvoice": false,
      "isCredited": false,
      "partiallyPaid": false,
      "paymentDate": null,
      "paymentPlan": null,
      "paymentPlanRowId": "",
      "quote": null,
      "quoteNumber": "",
      "reminderDate": null,
      "showPriceInclTaxesOnRows": false,
      "supplementOrder": null,
      "supplementOrderNumber": "",
      "totalCost": 4720
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves invoices.

HTTP Request

GET https://app.seventime.se/api/2/invoices

Query Parameters

E.g. https://app.seventime.se/api/2/invoices/?invoiceNumber=24481

Parameter Default Description
invoiceNumber If specified, invoices that match the parameter will be included.
OCRNumber If specified, invoices that match the parameter will be included.
customerNumber If specified, invoices that match the parameter will be included.
fromInvoiceDate If specified, invoices with invoice date after or on this date will be included. The date has to be in the format 'YYYY-MM-DD'
toInvoiceDate If specified, invoices with invoice date before or on this date will be included. The date has to be in the format 'YYYY-MM-DD'
fromDueDate If specified, invoices with due date after or on this date will be included. The date has to be in the format 'YYYY-MM-DD'
toDueDate If specified, invoices with due date before or on this date will be included. The date has to be in the format 'YYYY-MM-DD'
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Invoice

curl "https://app.seventime.se/api/2/invoices/5fab29b038b7789542665" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/invoices/5fab29b038b7789542665";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "deliveryAddress": {
      "name": "Kontoret",
      "address": "Ă–stra Gatan 129",
      "address2": "Västra Gatan 921",
      "zipCode": "12345",
      "city": "Stockholm",
      "country": "SE",
      "phone": "12345-6798"
    },
    "houseProperties": {
      "typeOfProperty": 1,
      "propertyDescription": "property description",
      "housingSocietyNumber": "",
      "apartmentNumber": "",
      "maxDeductionAmount": 100000,
      "personalNumber": "",
      "deductionDistribution": [
        {
          "_id": "5fae99b072aa3548648942372",
          "userName": "testUser",
          "personalNumber": "12345",
          "distributionPercent": 40
        },
        {
          // ...
        }
      ]
    },
    "timeLogIds": [],
    "expenseIds": [],
    "driverJournalIds": [],
    "machineTimeLogIds": [],
    "supplierInvoiceIds": [],
    "workOrderIds": [
      "5fa2b550c289ea55486219"
    ],
    "externalSystemExport": [],
    "tags": [
      "5f742440d608b22078942bd66",
      "5f74243ad608b25489256488b"
    ],
    "_id": "5fae99b072aa334cb5a5979425d",
    "createDate": "2020-11-13T14:35:28.797Z",
    "invoiceItems": [
      {
        "createDate": "2020-11-13T14:35:28.795Z",
        "_id": "5fae99b072aa334cb5399723547b",
        "houseWorkTypeOfWork": 1,
        "name": "**Skivhantel i Gummi 10 Kg****",
        "description": "Skivhantel av järn",
        "expenseItem": "5de78ae9bb1356594897615",
        "expenseItemName": "**Skivhantel i Gummi 10 Kg****",
        "itemType": "expense",
        "numberOfItems": 1,
        "unit": "St",
        "unitCost": 319,
        "totalCost": 319,
        "discountPercent": 0,
        "taxPercent": 0,
        "unitPrice": 12345,
        "totalAmount": 12345,
        "totalTaxAmount": 0,
        "totalAmountInclTax": 12345,
        "itemId": "0.9281811863461673",
        "itemOrder": 1024,
        "houseWorkFlag": true
      },
      {
        // ...  
      }
    ],
    "documents": [],
    "invoiceLogEntries": [
      {
        "logDate": "2020-11-13T14:35:28.797Z",
        "_id": "5fae99b072aa334c64897216",
        "logType": 1,
        "description": "",
        "user": "51714655fbb708f3647823159",
        "userName": "Anna Andersson",
        "additionalData": ""
      },
      {
        // ...
      }
    ],
    "partialPayments": [],
    "checkLists": [],
    "supplementOrders": [],
    "customFields": [
      {
        "_id": "5fb5217e4ea82f6477123584dd",
        "fieldId": "5f67af2796bce97845216892",
        "value": {
          "distributorId": null,
          "distributorName": ""
        }
      }
    ],
    "invoiceName": "Invoice",
    "marking": "marking",
    "yourOrderNumber": "12345",
    "notes": "invoice notes",
    "taxPercent": 12,
    "invoiceStatus": 2,
    "invoiceDate": "2020-11-04T23:00:00.000Z",
    "createdByUser": "51714655fbb708f3754578228",
    "createdByUserName": "Anna Andersson",
    "customer": "5cc05b6a4e595e6854976137451b",
    "customerName": "Company AB",
    "dueDate": "2020-12-04T23:00:00.000Z",
    "language": "EN",
    "project": "5b20cce1d59a979134679582",
    "projectName": "BlĂ¥sippan",
    "contactPerson": "5af95e6b1e56d12235489761954",
    "contactPersonName": "Anna Andersson",
    "ourReference": "518ff209d5af91647923578",
    "ourReferenceName": "Anna Andersson",
    "workOrder": "5fa2b550c289ea64845842b",
    "workOrderNumber": "4843",
    "invoiceType": 1,
    "resultUnit": "5784ff52fc71ce243d1354892",
    "resultUnitName": "Kontor Nord",
    "priceList": "57bc187159a73f3164915be",
    "priceListName": "Kundlista Inkl moms",
    "multipleTaxesOnRows": true,
    "currencyCode": "SEK",
    "totalAmount": 16549,
    "totalTaxAmount": 327.24,
    "totalAmountInclTax": 16876,
    "totalAmountRounding": -0.24,
    "sentDate": "2020-11-13T14:35:28.798Z",
    "invoiceNumber": "24481",
    "OCRNumber": "2448173",
    "archived": false,
    "archivedDate": null,
    "creditForInvoice": null,
    "creditForInvoiceNumber": "",
    "creditInvoice": null,
    "creditInvoiceNumber": "",
    "currencyRate": 1,
    "customerAddress": "Ă–stra Gatan 129<br>123 45 Stockholm",
    "customerEmail": "email@company.com",
    "customerNumber": "3028",
    "customerOrgNo": "",
    "customerVAT": "",
    "description": null,
    "discountInPercent": 0,
    "exportedToEconomy": false,
    "footerInfoText": null,
    "footerText": "<table width=\"100%\"><tr><td style='vertical-align: top;'><div><div><span style=\"font-size: 11px;\"></span></div></div></td><td style='vertical-align: top;'><div><span style=\"font-size: 11px;\">Efter förfallodagen debiteras dröjsmĂ¥lsränta: 13.0%</span></div><div><br></div></td><td style='vertical-align: top;'><span style=\"font-size: 11px;\">Ă„ganderättsförbehĂ¥ll tills full likvid erlagts</span><span style=\"font-size: 11px;\">.</span><br></td><td style='vertical-align: top;'><div><span style=\"font-size: 11px;\">Godkänd för F-skatt</span></div><div><br></div></td></tr></table>",
    "headerText": null,
    "houseDeductionAmount": 0,
    "houseDeductionBasisAmount": 0,
    "isCreditInvoice": false,
    "isCredited": false,
    "partiallyPaid": false,
    "paymentDate": null,
    "paymentPlan": null,
    "paymentPlanRowId": "",
    "quote": null,
    "quoteNumber": "",
    "reminderDate": null,
    "showPriceInclTaxesOnRows": false,
    "supplementOrder": null,
    "supplementOrderNumber": "",
    "totalCost": 4720
  }
}

This endpoint retrieves a specific invoice.

HTTP Request

GET https://app.seventime.se/api/2/invoices/<_id>

URL Parameters

Parameter Description
_id The _id of the invoice to retrieve

Get Invoice Tags

curl "https://app.seventime.se/api/2/invoiceTags/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/invoiceTags/";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "_id": "5f742440d608b22448b22791",
      "tagName": "Att granska",
      "color": "f44336"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves invoice tags.

HTTP Request

GET https://app.seventime.se/api/2/invoiceTags/

URL Parameters

Parameter Default Description
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Create an Invoice

curl -X POST "https://app.seventime.se/api/2/invoices/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"invoiceStatus":"2","customer":"571f21058d7f612467981357165","createdByUser":"51718241fdb7084835249227","language":"EN"}' 
let jsonData = {
  invoiceStatus: 'Support',
  customer: '571f21058d7f612467981357165',
  createdByUser: '51718241fdb7084835249227',
  language: 'EN'
};

let options = {
  url: 'https://app.seventime.se/api/2/invoices',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.post(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Invoice created: _id: " + body._id);
  } else {
    console.error("ERROR! Unable to create invoice: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
  "timeLogIds": [],
  "expenseIds": [],
  "driverJournalIds": [],
  "machineTimeLogIds": [],
  "supplierInvoiceIds": [],
  "workOrderIds": [],
  "externalSystemExport": [],
  "tags": [],
  "_id": "5fb64449b0cc951024822167",
  "createDate": "2020-11-19T10:09:13.039Z",
  "invoiceItems": [],
  "documents": [],
  "invoiceLogEntries":
   [ 
    { "_id": "5fb64449b0cc95679815",
       "logType": 1,
       "description": "",
       "user": "5f48eb3e65d7479134682",
       "userName": "Anna Andersson",
       "additionalData": "",
       "logDate": "2020-11-19T10:09:13.039Z" },
     { 
     // ...
     } 
   ],
  "partialPayments": [],
  "checkLists": [],
  "supplementOrders": [],
  "customFields": [],
  "invoiceName": "Invoice",
  "marking": "",
  "yourOrderNumber": "",
  "notes": "",
  "taxPercent": 25,
  "invoiceStatus": 2,
  "invoiceDate": "2020-11-19T10:09:13.033Z",
  "createdByUser": "51718241fdb7084835249227",
  "createdByUserName": "Anna Andersson",
  "customer": "571f21058d7f612467981357165",
  "customerName": "Company",
  "dueDate": "2020-12-09T22":59":59.999Z",
  "language": "EN",
  "invoiceType": 0,
  "totalAmount": 0,
  "totalTaxAmount": 0,
  "totalAmountInclTax": 0,
  "totalAmountRounding": 0,
  "totalCost": 0,
  "sentDate": "2020-11-19T10:09:13.040Z",
  "invoiceNumber": "24511",
  "OCRNumber": "2451177",
}
"Invoice created: _id: 5fb64449b0cc951024822167"

This endpoint creates an invoice

HTTP Request

POST https://app.seventime.se/api/2/invoices/

POST Parameters

Parameter Type Required? Description
customer String Yes Customer id for the customer who the invoice should belong to
createdByUser String Yes Id of the user who created the invoice
language String Yes Language of the invoice given as a language code, e.g. SV for Swedish
name String No Name of the invoice. If not specified, this will be set to 'Invoice' translated to the selected language
invoiceDate String No Invoice date. Has to be in the format YYYY-MM-DD. If not specified, this will be set to the current date
dueDate String No Due date. Has to be in the format YYYY-MM-DD. If not specified, this will be set to the invoice date + the default payment terms
project String No Id of the project of the invoice
marking String No Marking on the invoice
yourOrderNumber String No Your order number
invoiceStatus Number No Status of the invoice. 1 for 'Draft' and 2 for 'Sent'
contactPerson String No Id of the contact person. This contact person has to belong to the selected customer
ourReference Number No Id of the user that will be set as our reference.
deliveryAddress Object No Contains attributes for delivery address. See below for details
workOrder String No Id of the work order
resultUnit String No Id of the result unit
invoiceType Number No Type of invoice. 0 for Normal, 1 for ROT, 2 for RUT and 3 for construction
houseProperties Object No* *Required if invoiceType is set to 1 or 2. See below for details
priceList String No Id of the price list to be used. If specified, prices from the price list will be used for invoice items
multipleTaxesOnRows Boolean No Should it be possible to set different taxes on invoice items? If set to false, all invoice items will use the same tax percent
taxPercent Number No Tax percent which will be used if multipleTaxesOnRows is set to false. This must be 0, 6, 12 or 25% and if not specified will be set to 25%.
currencyCode String No Currency code to be used on the invoice
currencyRate Number No Currency rate between SEK and the selected currency
notes String No Notes on the invoice
invoiceItems Array No Array containing objects with invoice items. See below for details.
tags Array No Array of tag ids
useFooterFromSettings Boolean No Do you want to use the footer that's specified in the settings?
footerText String No Footer text which will be used if useFooterFromSettings is set to false

Attributes for deliveryAddress

Parameter Type Required? Description
name String No Name of delivery recipient
address String No Primary address
address2 String No Secondary address
zipCode String No Zip code
city String No City
country String No Country, given as a country code (E.g. SE for Sweden)
phone String No Phone number

House properties for ROT/RUT invoices

Parameter Type Required? Description
typeOfProperty Number Yes Type of property. 1 for Detached property and 2 for Condominium association
propertyDescription String No* *Required if typeOfProperty is set to 1
housingSocietyNumber String No* *Required if typeOfProperty is set to 2
apartmentNumber String No* *Required if typeOfProperty is set to 2
deductionDistribution Array No Contains attributes for deduction distribution. See below for details

Deduction distribution for ROT/RUT invoices

The field deductionDistribution should be an array containing objects with the attributes shown below

Parameter Type Required? Description
userName Number No User name
personalNumber String No Personal number
distributionPercent String No Distribution percent

Attributes for invoiceItems

The field invoiceItems should be an array containing objects with the attributes shown below

Parameter Type Required? Description
itemType String Yes Item type of invoice row, see below for details
expenseItem String No* Id of the expense. *Required if itemType is expense
timeCategory String No* Id of the time category. *Required if itemType is timelog
machine String No* Id of the machine. *Required if itemType is machineTimeLog
driverJournalItemType String No* Id of the driver journal. *Required if itemType is driverJournal
numberOfItems Number No Quantity of the item. If not specified, this will be set to 1
unit String No Unit of the item
unitCost Number No Purchase price of the item
unitPrice Number No Unit price of the item
pricePerHour Number No Price per hour. Used for time log rows
totalAmount Number No Total amount. Used for onlyamount rows
discountPercent Number No Discount of the item
taxPercent Number No Tax percent of the item. Only used if multipleTaxesOnRows is true. This must be 0, 6, 12 or 25% and if not specified, this will be set to 25%.
houseWorkTypeOfWork Number No Type of work for the row. Used if invoiceType is 1 or 2. See below for details

Item types

This table contains the different item types used in the field invoiceItems.itemTypes

Item type Description
expense Expense row
timeLog Time log row
general Free-text row
blank Blank row
text Text row
onlyamount Text+amount row
machineTimeLog Machine time log row
driverJournal Driver journal row

Available type of work for ROT/RUT invoices

Code Invoice type Description
0 None
1 ROT Construction
2 ROT Electrical
3 ROT Windows/Metal
4 ROT Ground work
5 ROT Brick work
6 ROT Painting
7 ROT Plumbing
20 ROT Heat pump 30%
21 ROT Heat pump 35%
9 RUT Cleaning
10 RUT Textile
12 RUT Snow removal
13 RUT Gardening
14 RUT Child care
15 RUT Personal care
18 RUT Moving services
19 RUT IT services
22 RUT Repair of appliances

Update an Invoice

curl -X PUT "https://app.seventime.se/api/2/invoices/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"5fb64449b0cc951024822167","customer":"571f21058d7f616498213765","modifiedByUser":"51718241fdb7894158127","language":"EN"}' 
let jsonData = {
  _id: '5fb64449b0cc951024822167',
  modifiedByUser: '51718241fdb7894158127',
  invoiceName: 'Invoice 2020-12',
  customer: '571f21058d7f616498213765',
  multipleTaxesOnRows: 'true',
  taxPercent: 25,
  invoiceItems: [{...}, ...]
};

let options = {
  url: 'https://app.seventime.se/api/2/invoices',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.put(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Invoice updated: " + body.invoiceName + ", _id: " + body._id);
  } else {
    console.error("ERROR! Unable to update invoice: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
  "timeLogIds": [],
  "expenseIds": [],
  "driverJournalIds": [],
  "machineTimeLogIds": [],
  "supplierInvoiceIds": [],
  "workOrderIds": [],
  "externalSystemExport": [],
  "tags": [],
  "_id": "5fb64449b0cc951024822167",
  "createDate": "2020-11-19T10:09:13.039Z",
  "invoiceItems": [{...}, ...],
  "documents": [],
  "invoiceLogEntries":
   [ 
    { "_id": "5fb64449b0cc9510a561dfe0",
       "logType": 1,
       "description": "",
       "user": "5f48eb3e65d7e976825602",
       "userName": "Anna Andersson",
       "additionalData": "",
       "logDate": "2020-11-19T10:09:13.039Z" },
     { 
     // ...
     } 
   ],
  "partialPayments": [],
  "checkLists": [],
  "supplementOrders": [],
  "customFields": [],
  "invoiceName": "Invoice 2020-12",
  "marking": "",
  "yourOrderNumber": "",
  "notes": "",
  "taxPercent": 25,
  "invoiceStatus": 2,
  "invoiceDate": "2020-11-19T10:09:13.033Z",
  "createdByUser": "5f48eb3e65d7ee494b523978"
  "createdByUserName": "Anna Andersson",
  "customer": "571f21058d7f618a264217895",
  "customerName": "Company AB",
  "dueDate": "2020-12-09T22":59":59.999Z",
  "language": "EN",
  "invoiceType": 0,
  "totalAmount": 0,
  "totalTaxAmount": 0,
  "totalAmountInclTax": 0,
  "totalAmountRounding": 0,
  "totalCost": 0,
  "sentDate": "2020-11-19T10:09:13.040Z",
  "invoiceNumber": "24511",
  "OCRNumber": "2451177",
}

This endpoint updates an invoice

HTTP Request

PUT https://app.seventime.se/api/2/invoices/

PUT Parameters

The table below shows the required fields or fields that differ from 'Create an Invoice'. Other available fields can be found in the section 'Create an Invoice'.

Parameter Type Required? Description
_id String Yes Id of the invoice
modifiedByUser String Yes Id of the user who modified the invoice
multipleTaxesOnRows Boolean Yes Should it be possible to use different tax rates on invoice rows?
taxPercent Boolean Yes* Tax rate on invoice rows *Required if 'multipleTaxesOnRows' is false.
invoiceItems Array Yes Array containing the invoice items. See the section 'Create an Invoice' for more information about these items
invoiceStatus Number No Invoice status. 1 for 'Draft', 2 for 'Sent', 3 for 'Paid' and 4 for 'Obliterated'. Note that changing the status to 'Sent' will not send the invoice, this will mark the invoice as sent and give the invoice a number. It is only possible to set the status to 'Paid' or 'Obliterated' on a sent invoice.

Machines

Get Machines

curl "https://app.seventime.se/api/2/machines/?limit=10&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/machines/?limit=10&page=1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey"
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 30,
    "totalPages": 3,
    "currentPage": 2
  },
  "data": [
    {
      "_id": "5a4bc02e40a13d71799764283",
      "lastHoursUsedRegDate": "2020-09-27T12:06:19.225Z",
      "hoursUsed": 5193,
      "lastMileageRegDate": "2020-09-27T12:06:19.225Z",
      "mileage": 10122.7,
      "isActive": true,
      "createdByUserName": "Anna Andersson",
      "createdByUser": "5113986056b831a917962158",
      "hoursCanBeRegistered": true,
      "canBePlanned": true,
      "isInvoiceable": true,
      "serialNumber": "846821",
      "machineModel": "ME500",
      "machineNumber": "21",
      "machineName": "EWR150E-21",
      "trackunitData": {
        "id": "1135803"
      },
      "modifiedDate": "2020-09-27T12:06:19.225Z",
      "createDate": "2018-01-02T17:37:02.629Z",
      "machineLog": [],
      "documents": [],
      "articleNumber": "",
      "machineType": null,
      "machineTypeName": "",
      "machineGroup": "",
      "purchaseDate": null,
      "serviceable": false,
      "serviceIntervalInKm": 0,
      "serviceIntervalInHours": 0,
      "serviceIntervalInMonths": 0,
      "mileageLastService": 0,
      "hoursLastService": 0,
      "lastServiceDate": null,
      "unitPrice": 0,
      "unitCost": 0,
      "distributor": null,
      "distributorName": "",
      "customFields": [],
      "debitManualRegistrationPrices": [],
      "debitMinimiPrices": [],
      "debitSchedulePrices": [],
      "isSupplementForMachines": []
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves machines.

HTTP Request

GET https://app.seventime.se/api/2/machines

Query Parameters

E.g. https://app.seventime.se/api/2/machines/?machineNumber=21

Parameter Default Description
name If specified, invoices that match the parameter will be included.
machineNumber If specified, invoices that match the parameter will be included.
machineTypeName If specified, invoices that match the parameter will be included.
machineModel If specified, invoices that match the parameter will be included.
serialNumber If specified, invoices that match the parameter will be included.
serviceable If specified, invoices that match the parameter will be included.
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Machine

curl "https://app.seventime.se/api/2/machines/5a4bc02e40a13d71799764283" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/machines/5a4bc02e40a13d71799764283";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "trackunitData": {
      "id": "1135803"
    },
    "machineLog": [],
    "isSupplementForMachines": [],
    "_id": "5a4bc02e40a13d71799764283",
    "lastHoursUsedRegDate": "2020-09-27T12:06:19.225Z",
    "hoursUsed": 5193,
    "lastMileageRegDate": "2020-09-27T12:06:19.225Z",
    "mileage": 10122.7,
    "isActive": true,
    "createdByUserName": "Anna Andersson",
    "createdByUser": "5113986056b831a96489527",
    "hoursCanBeRegistered": true,
    "canBePlanned": true,
    "isInvoiceable": true,
    "serialNumber": "846821",
    "machineModel": "ME500",
    "machineNumber": "21",
    "machineName": "EWR150E-21",
    "modifiedDate": "2020-09-27T12:06:19.225Z",
    "createDate": "2018-01-02T17:37:02.629Z",
    "documents": [],
    "articleNumber": "",
    "machineType": null,
    "machineTypeName": "",
    "machineGroup": "",
    "purchaseDate": null,
    "serviceable": false,
    "serviceIntervalInKm": 0,
    "serviceIntervalInHours": 0,
    "serviceIntervalInMonths": 0,
    "mileageLastService": 0,
    "hoursLastService": 0,
    "lastServiceDate": null,
    "unitPrice": 0,
    "unitCost": 0,
    "distributor": null,
    "distributorName": "",
    "customFields": [],
    "debitManualRegistrationPrices": [],
    "debitMinimiPrices": [],
    "debitSchedulePrices": []
  }
}

This endpoint retrieves a specific machine.

HTTP Request

GET https://app.seventime.se/api/2/machine/<_id>

URL Parameters

Parameter Description
_id The _id of the machine to retrieve

Get Machine Types

curl "https://app.seventime.se/api/2/machineTypes/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/machineTypes/";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "_id": "57e89fbae191f8ba548916",
      "name": "Fordon",
      "isActive": true,
      "createDate": "2017-10-19T12:50:50.361Z"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves machine types.

HTTP Request

GET https://app.seventime.se/api/2/machineTypes/

URL Parameters

Parameter Default Description
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Machine Time Logs

Get Machine Time Logs

curl "https://app.seventime.se/api/2/machineTimeLogs/?limit=20&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/machineTimeLogs/?limit=20&page=1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 55,
    "totalPages": 28,
    "currentPage": 27
  },
  "data": [
    {
      "_id": "59ef428433092a453647952813",
      "time": 12,
      "invoiceableTime": 12,
      "description": "12",
      "internalDescription": "",
      "attestedBy": null,
      "invoice": null,
      "machine": "59e75917ae561db737946137",
      "machineName": "Grävare",
      "user": "51203146506d966481937",
      "userName": "Anna Andersson",
      "department": "58b30abde244b75d15648293",
      "departmentName": "Utveckling",
      "customer": null,
      "customerName": null,
      "project": null,
      "projectName": null,
      "workOrder": null,
      "workOrderTitle": "",
      "workOrderNumber": 0,
      "pricePerHour": 0,
      "price": 0,
      "cost": 0,
      "createDate": "2017-10-24T13:39:16.764Z",
      "isInvoiced": false,
      "isInvoiceable": true,
      "status": 1,
      "timestamp": "2017-10-24T13:39:06.144Z"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves machine time logs.

HTTP Request

GET https://app.seventime.se/api/2/machineTimeLogs

Query Parameters

Parameter Default Description
fromDate If specified, machine time logs registered after or on this date will be included. The date has to be in the format 'YYYY-MM-DD'
toDate If specified, machine time logs registered before or on this date will be included. The date has to be in the format 'YYYY-MM-DD'
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Machine Time Log

curl "https://app.seventime.se/api/2/machines/5a4bc02e40a13d77915827619" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/machines/5a4bc02e40a13d77915827619";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "status": 1,
    "isInvoiceable": true,
    "isInvoiced": false,
    "_id": "5a4bc02e40a13d77915827619",
    "time": 12,
    "invoiceableTime": 12,
    "description": "12",
    "internalDescription": "",
    "attestedBy": null,
    "invoice": null,
    "machine": "59e75917ae561db7364829167",
    "machineName": "Grävare",
    "user": "51203146506d97461389557821",
    "userName": "Anna Andersson",
    "department": "58b30abde244b75d464826137958",
    "departmentName": "Utveckling",
    "customer": null,
    "customerName": null,
    "project": null,
    "projectName": null,
    "workOrder": null,
    "workOrderTitle": "",
    "workOrderNumber": 0,
    "pricePerHour": 0,
    "price": 0,
    "cost": 0,
    "createDate": "2017-10-24T13:39:16.764Z",
    "timestamp": "2017-10-24T13:39:06.144Z"
  }
}

This endpoint retrieves a specific machine time log.

HTTP Request

GET https://app.seventime.se/api/2/machineTimeLog/<_id>

URL Parameters

Parameter Description
_id The _id of the machine time log to retrieve

Price Lists

Get price lists

curl "https://app.seventime.se/api/2/priceLists/?limit=10&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/priceLists/?limit=10&page=1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 5,
    "totalPages": 1,
    "currentPage": 1
  },
  "data": [
    {
      "_id": "58c1504a658fb5911d6489528",
      "name": "Grosslistan",
      "isActive": true
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves price lists.

HTTP Request

GET https://app.seventime.se/api/2/priceLists

Query Parameters

Parameter Default Description
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Price List

curl "https://app.seventime.se/api/2/priceLists/58c1504a658fb5911d6489528" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/priceLists/58c1504a658fb5911d6489528";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "_id": "58c1504a658fb5911d6489528",
    "isActive": true,
    "name": "Ă…F-prislista"
  }
}

This endpoint retrieves a specific price list.

HTTP Request

GET https://app.seventime.se/api/2/priceLists/<_id>

URL Parameters

Parameter Description
_id The _id of the price list to retrieve

Projects

Get Projects

curl "https://app.seventime.se/api/2/projects/?limit=10&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/projects/?limit=10&page=1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 397,
    "totalPages": 40,
    "currentPage": 7
  },
  "data": [
    {
      "_id": "5f924f4f533f102af754891365",
      "permissions": {
        "permUsers": [],
        "permRoles": [],
        "permissionFlag": 1
      },
      "tags": [],
      "name": "FrĂ¥n offert 20200811",
      "projectNumber": "3314",
      "projectStatus": 50,
      "projectStatusRef": "5c8739d3205457b98b87952643",
      "projectType": null,
      "projectTypeName": null,
      "billingMethod": "FIXED_PRICE",
      "pricePerHour": 0,
      "fixedPrice": 0,
      "fixedPriceInvoiced": false,
      "fixedPriceLeftToInvoice": 0,
      "fixedPriceExpenseItem": null,
      "timeCategoryPriceList": null,
      "estimatedTime": 0,
      "recurringBudgetType": 10,
      "recurringBudget": {
        "budgetTime": 0,
        "budgetAmount": 0,
        "budgetType": 10
      },
      "resultUnit": null,
      "resultUnitName": "",
      "customer": "5763e05bcddce98e379431679",
      "customerName": "Company",
      "contactPerson": null,
      "contactPersonName": null,
      "projectLeader": null,
      "projectLeaderName": null,
      "quote": "5b110ea19b27f5ef3f79842658",
      "quoteNumber": "1058",
      "department": null,
      "departmentName": "",
      "marking": "",
      "yourOrderNumber": "1058",
      "deliveryAddress": {
        "name": "",
        "address": "",
        "address2": "",
        "zipCode": "",
        "city": "",
        "country": "",
        "phone": ""
      },
      "invoiceStatus": 0,
      "notes": "",
      "documents": [],
      "startDate": null,
      "endDate": null,
      "budget": {
        "typeOfBenefitCalc": 1,
        "benefits": [],
        "benefitTotal": 0,
        "typeOfCostCalc": 1,
        "costs": [],
        "costTotal": 0
      },
      "budgetCalculation": {
        "invoiceItems": [],
        "totalBenefitAmount": 0,
        "totalCostAmount": 0
      },
      "enableConstructionDiary": false,
      "enablePaymentPlans": false,
      "timeCategoryItems": [],
      "expenseItemItems": [],
      "staffLedger": {
        "workPlaceIDNumber": "",
        "developerName": "",
        "developerOrgNumber": ""
      },
      "projectTimeNotification": {
        "sent": false,
        "notifyAtPercent": 0
      },
      "workRuleStartOfDay": null,
      "workRuleEndOfDay": null,
      "timeLogRegistrationMethods": [],
      "timeShouldNotBeWorkTime": false,
      "enablePortalAccess": false,
      "projectResources": [],
      "checkLists": [],
      "color": "FAFAFA",
      "isActive": true,
      "comments": [],
      "customFields": [
        {
          "_id": "5f326f50433f102ff77995135845",
          "fieldId": "5c0e7342ce9a6471798426587",
          "value": "Prioritet"
        }
      ],
      "createdDate": "2020-08-11T10:13:36.001Z",
      "modifiedDate": "2020-08-11T10:13:36.002Z"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves projects.

HTTP Request

GET https://app.seventime.se/api/2/projects

Query Parameters

E.g. https://app.seventime.se/api/2/projects/?projectNumber=3314

Parameter Default Description
name If specified, projects that match the parameter will be included.
projectNumber If specified, projects that match the parameter will be included.
lastModified If specified, projects that has been modified since the specified timestamp will be included. Accepted formats: 'YYYY-MM-HH HH:MM', 'YYYY-MM-HH HH:MM:SS', 'YYYY-MM-HHTHH:MM', 'YYYY-MM-HHTHH:MM:SS'
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific project

curl "https://app.seventime.se/api/2/projects/5f924f4f533f102af7879132584" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/projects/5f924f4f533f102af7879132584";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "recurringBudget": {
      "budgetTime": 0,
      "budgetAmount": 0,
      "budgetType": 10
    },
    "deliveryAddress": {
      "name": "",
      "address": "",
      "address2": "",
      "zipCode": "",
      "city": "",
      "country": "",
      "phone": ""
    },
    "budget": {
      "typeOfBenefitCalc": 1,
      "benefits": [],
      "benefitTotal": 0,
      "typeOfCostCalc": 1,
      "costs": [],
      "costTotal": 0
    },
    "budgetCalculation": {
      "invoiceItems": [],
      "totalBenefitAmount": 0,
      "totalCostAmount": 0
    },
    "permissions": {
      "permUsers": [],
      "permRoles": [],
      "permDepartments": [],
      "permissionFlag": 1
    },
    "staffLedger": {
      "workPlaceIDNumber": "",
      "developerName": "",
      "developerOrgNumber": ""
    },
    "projectTimeNotification": {
      "sent": false,
      "notifyAtPercent": 0
    },
    "tags": [],
    "_id": "5f924f4f533f102af7879132584",
    "name": "FrĂ¥n offert 20200811",
    "projectNumber": "3314",
    "projectStatus": 50,
    "projectStatusRef": "5c8639c3205457b88d64895287",
    "projectType": null,
    "projectTypeName": null,
    "billingMethod": "FIXED_PRICE",
    "pricePerHour": 0,
    "fixedPrice": 0,
    "fixedPriceInvoiced": false,
    "fixedPriceLeftToInvoice": 0,
    "fixedPriceExpenseItem": null,
    "timeCategoryPriceList": null,
    "estimatedTime": 0,
    "recurringBudgetType": 10,
    "resultUnit": null,
    "resultUnitName": "",
    "customer": "5763e05bcddce98e3648522971",
    "customerName": "Company",
    "contactPerson": null,
    "contactPersonName": null,
    "projectLeader": null,
    "projectLeaderName": null,
    "quote": "5b110ea19b27f5ef3f364495217",
    "quoteNumber": "1058",
    "department": null,
    "departmentName": "",
    "marking": "",
    "yourOrderNumber": "1058",
    "invoiceStatus": 0,
    "notes": "",
    "documents": [],
    "startDate": null,
    "endDate": null,
    "enableConstructionDiary": false,
    "enablePaymentPlans": false,
    "timeCategoryItems": [],
    "expenseItemItems": [],
    "workRuleStartOfDay": null,
    "workRuleEndOfDay": null,
    "timeLogRegistrationMethods": [],
    "timeShouldNotBeWorkTime": false,
    "enablePortalAccess": false,
    "projectResources": [],
    "checkLists": [],
    "color": "FAFAFA",
    "isActive": true,
    "comments": [],
    "customFields": [
      {
        "_id": "5f326f50433f102ff648795218",
        "fieldId": "5c0e7342ce9a6477946287687",
        "value": "Prioritet"
      }
    ],
    "createdDate": "2020-08-11T10:13:36.001Z",
    "modifiedDate": "2020-08-11T10:13:36.002Z"
  }
}

This endpoint retrieves a specific project.

HTTP Request

GET https://app.seventime.se/api/2/projects/<_id>

URL Parameters

Parameter Description
_id The _id of the project to retrieve

Get Project statuses

curl "https://app.seventime.se/api/2/projectStatuses/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/projectStatuses/";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "_id": "5c8639c4704957d884791328",
      "statusName": "Avslutad",
      "color": "468847",
      "inProgressStatus": false,
      "closedStatus": true,
      "isActive": true
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves project statuses.

HTTP Request

GET https://app.seventime.se/api/2/projectStatuses/

URL Parameters

Parameter Default Description
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get Project types

curl "https://app.seventime.se/api/2/projectTypes/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/projectTypes/";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "_id": "5b276a908e0273b74648125987",
      "projectTypeName": "Dev",
      "isActive": true
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves project types.

HTTP Request

GET https://app.seventime.se/api/2/projectTypes/

URL Parameters

Parameter Default Description
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get Project tags

curl "https://app.seventime.se/api/2/projectTags/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/projectTags/";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "_id": "5fb2c736deb93b2713316795846",
      "tagName": "Viktigt",
      "color": "673ab7"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves project tags.

HTTP Request

GET https://app.seventime.se/api/2/projectTags/

URL Parameters

Parameter Default Description
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Create a Project

curl -X POST "https://app.seventime.se/api/2/projects/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"createdByUser":"5f48eb3e65d7e9781358587","name":"App development"}' 
const jsonData = {
  createdByUser: '5f48eb3e65d7e9781358587',
  name: 'App development',
};

const options = {
  url: 'https://app.seventime.se/api/2/projects',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.post(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Project created: " + body.name + ", _id: " + body._id);
  } else {
    console.error("ERROR! Unable to create project: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
    "budget": { "benefits": [], "costs": [] },
    "budgetCalculation": { "invoiceItems": [] },
    "permissions": { "permUsers": [], "permRoles": [], "permDepartments": [] },
    "_id": "5fb3c92dd5472a24647985231",
    "tags": [],
    "createdDate": "2020-11-17T12:59:25.109Z",
    "modifiedDate": "2020-11-17T12:59:25.109Z",
    "documents": [],
    "timeCategoryItems": [],
    "expenseItemItems": [],
    "timeLogRegistrationMethods": [],
    "projectResources": [],
    "checkLists": [],
    "comments": [],
    "customFields": [],
    "name": "App development",
    "projectNumber": "12345786" 
}
"Project created: App development, _id: 5fb3c92dd5472a24647985231"

This endpoint creates a project.

HTTP Request

POST https://app.seventime.se/api/2/projects

POST Parameters

Parameter Type Required? Description
createdByUser String Yes Id of the user who created the project
name String Yes Name of the project
projectNumber Number No Project number must be unique if specified. If not specified, it will be automatically assigned
projectStatusRef String No Id of the status of the project
customer String No Id of the customer of the project
contactPerson String No Id of the contact person. This field requires that customer is specified and that the customer person belongs to that customer
invoiceStatus Number No Invoice status of the project. See below for available statuses
projectLeader String No Id of the user who should be the project leader
projectType String No Id of the project type
department String No Id of the department
startDate String No Start date of the project in the format YYYY-MM-DD
endDate String No End date of the project in the format YYYY-MM-DD
notes String No Notes to be included in the project
resultUnit String No Id of the result unit of the project
billingMethod String No Billing method of the project. See below for available billing methods
pricePerHour Number No* Required if billingMethod is set to HOURLY
fixedPrice Number No* Required if billingMethod is set to FIXED_PRICE
timeCategoryPriceList String No* Required if billingMethod is set to PRICELIST
projectTags Array No Array containing ids of tags
marking String No Marking on project
yourOrderNumber String No Your order number
deliveryAddress Object No Contains attributes for delivery address. See below for details

Invoice statuses for projects

Code Status
0 None
5 Not invoiceable
10 Ready to be invoiced
20 Partly invoiced
30 Fully invoiced

Billing methods for projects

Code Billing method
ACCORDING_TO_CUSTOMER This requires that the customer has a billing method set
HOURLY Hourly price
PERUSER The price will be set per user
HOURLY_PER_TIMECATEGORY Price will be set according to time category
FIXED_PRICE Fixed price
PRICELIST Price will be set according to a price list

Attributes for deliveryAddress

Parameter Type Required? Description
name String No Name of delivery recipient
address String No Primary address
address2 String No Secondary address
zipCode String No Zip code
city String No City
country String No Country, given as a country code (E.g. SE for Sweden)
phone String No Phone number

Update a Project

curl -X PUT "https://app.seventime.se/api/2/projects/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"5fb3c92dd5472a24647985231","name":"App development","customer":"571f61330c7f498a2d057941635","modifiedByUser":"51718241fdb708f3795364795"}' 
const jsonData = {
  _id: '5fb3c92dd5472a24647985231',
  modifiedByUser: '51718241fdb708f3795364795',
  name: 'App development',
  customer: '571f61330c7f498a2d057941635'
};

const options = {
  url: 'https://app.seventime.se/api/2/projects',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.put(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Project updated: " + body.name + ", _id: " + body._id);
  } else {
    console.error("ERROR! Unable to update project: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
    "budget": { "benefits": [], "costs": [] },
    "budgetCalculation": { "invoiceItems": [] },
    "permissions": { "permUsers": [], "permRoles": [], "permDepartments": [] },
    "_id": "5fb3c92dd5472a24647985231",
    "tags": [],
    "createdDate": "2020-11-17T12:59:25.109Z",
    "modifiedDate": "2020-11-17T12:59:25.109Z",
    "documents": [],
    "timeCategoryItems": [],
    "expenseItemItems": [],
    "timeLogRegistrationMethods": [],
    "projectResources": [],
    "checkLists": [],
    "comments": [],
    "customFields": [],
    "name": "App development",
    "projectNumber": "12345786",
    "customer": "571f61330c7f498a2d057941635",
    "customerName": "Company AB"
}
"Project updated: App development, _id: 5fb3c92dd5472a24647985231"

This endpoint updates a project.

HTTP Request

PUT https://app.seventime.se/api/2/projects/?_id=5fb3c92dd5472a24647985231&modifiedByUser=51718241fdb708f3795364795&name=App development&customer=571f61330c7f498a2d0001a4

PUT Parameters

The table below shows the required fields. Other available fields can be found in the section 'Create a Project'.

Parameter Type Required? Description
_id String Yes Id of the project
modifiedByUser String Yes Id of the user who made the change

Purchase Orders

Get Purchase Orders

curl "https://app.seventime.se/api/2/purchaseOrders/?limit=2&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/purchaseOrders/?limit=2&page=1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 70,
    "totalPages": 35,
    "currentPage": 5
  },
  "data": [
    {
      "_id": "59d6041d5551819581097514",
      "purchaseOrderNumber": "1009",
      "purchaseOrderName": "Beställning",
      "purchaseOrderInfoName": "ererer",
      "language": "SV",
      "headerText": "Vi önskar att beställa följande.",
      "footerText": "<table width=\"100%\"><tr><td style='vertical-align: top;'>FIRST</td><td style='vertical-align: top;'>SECOND</td></tr></table>",
      "footerInfoText": "",
      "createdByUser": "5f48eb3e65d7ee497945281",
      "createdByUserName": "Anna Andersson",
      "ourReference": "5f48eb3e65d7ee497945281",
      "ourReferenceName": "Anna Andersson",
      "approvedBy": null,
      "distributor": "5f6b2e6af24d5df55b69277",
      "distributorName": "Company",
      "distributorAddress": "Ă–stra Gatan 129<br>123 45 Stockholm",
      "distributorVAT": "",
      "ourCustomerNumber": "123456",
      "contactPersonDistributor": null,
      "contactPersonDistributorName": null,
      "project": null,
      "projectName": null,
      "workOrder": null,
      "workOrderName": "",
      "workOrderNumber": "0",
      "purchaseOrderDate": "2017-09-11T13:30:55.026Z",
      "totalAmount": 1000,
      "totalTaxAmount": 250,
      "totalAmountInclTax": 1250,
      "taxPercent": 25,
      "totalCost": 0,
      "currencyCode": "SEK",
      "currencyRate": 1,
      "purchaseOrderStatus": 4,
      "archived": false,
      "archivedDate": null,
      "sentDate": "2017-09-11T13:31:08.972Z",
      "confirmationDate": "2017-09-11T13:31:41.071Z",
      "desiredDeliveryDate": null,
      "expectedDeliveryDate": "2017-09-14T22:00:00.000Z",
      "paymentDays": 30,
      "marking": "",
      "deliveryAttention": "",
      "deliveryPhone": "",
      "publicLink": "l0qMb5V9L1uVMBUyhND",
      "approvedByName": null,
      "invoiceAddress": {
        "address": "Ă–stra Gatan 129",
        "address2": "",
        "zipCode": "12345",
        "city": "Stockholm",
        "country": "",
        "email": "",
        "name": "Company"
      },
      "deliveryAddress": {
        "name": "",
        "address": "",
        "address2": "",
        "zipCode": "",
        "city": "",
        "country": "",
        "phone": ""
      },
      "documents": [],
      "purchaseOrderLogEntries": [
        {
          "_id": "5f48eb3e65d7ee49546892",
          "logType": 5,
          "description": "",
          "user": "59312765ad961c03113468",
          "userName": "Anna Andersson",
          "logDate": "2017-09-11T13:31:08.972Z"
        },
        {
          // ...
        }
      ],
      "invoiceItems": [
        {
          // ...
        }
      ],
      "createDate": "2017-09-11T13:31:08.963Z",
      "projectNumber": "183897"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves purchase orders.

HTTP Request

GET https://app.seventime.se/api/2/purchaseOrders

Query Parameters

Parameter Default Description
purchaseOrderName If specified, purchase orders that match the parameter will be included.
purchaseOrderInfoName If specified, purchase orders that match the parameter will be included.
purchaseOrderNumber If specified, purchase orders that match the parameter will be included.
purchaseOrderStatus If specified, purchase orders that match the parameter will be included.
distributor If specified, purchase orders that match the parameter will be included.
project If specified, purchase orders that match the parameter will be included.
workOrder If specified, purchase orders that match the parameter will be included.
workOrderNumber If specified, purchase orders that match the parameter will be included.
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Purchase Order

curl "https://app.seventime.se/api/2/purchaseOrders/59d6041d5551819581097514" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/purchaseOrders/59d6041d5551819581097514";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "deliveryAddress": {
      "name": "",
      "address": "",
      "address2": "",
      "zipCode": "",
      "city": "",
      "country": "",
      "phone": ""
    },
    "invoiceAddress": {
      "address": "Ă–stra Gatan 129",
      "address2": "",
      "zipCode": "12345",
      "city": "Stockholm",
      "country": "",
      "email": "",
      "name": "Company"
    },
    "_id": "59d6041d5551819581097514",
    "purchaseOrderNumber": "1009",
    "purchaseOrderName": "Beställning",
    "purchaseOrderInfoName": "ererer",
    "language": "SV",
    "headerText": "Vi önskar att beställa följande.",
    "footerText": "<table width=\"100%\"><tr><td style='vertical-align: top;'>FIRST</td><td style='vertical-align: top;'>SECOND</td></tr></table>",
    "footerInfoText": "",
    "createdByUser": "5f48eb3e65d7ee494496723",
    "createdByUserName": "Anna Andersson",
    "ourReference": "5f48eb3e65d7ee494496723",
    "ourReferenceName": "Anna Andersson",
    "approvedBy": null,
    "distributor": "5f6b2e6af24d5df5679485",
    "distributorName": "Company",
    "distributorAddress": "Ă–stra Gatan 129<br>123 45 Stockholm",
    "distributorVAT": "",
    "ourCustomerNumber": "123456",
    "contactPersonDistributor": null,
    "contactPersonDistributorName": null,
    "project": null,
    "projectName": null,
    "workOrder": null,
    "workOrderName": "",
    "workOrderNumber": "0",
    "purchaseOrderDate": "2017-09-11T13:30:55.026Z",
    "totalAmount": 1000,
    "totalTaxAmount": 250,
    "totalAmountInclTax": 1250,
    "taxPercent": 25,
    "totalCost": 0,
    "currencyCode": "SEK",
    "currencyRate": 1,
    "purchaseOrderStatus": 4,
    "archived": false,
    "archivedDate": null,
    "sentDate": "2017-09-11T13:31:08.972Z",
    "confirmationDate": "2017-09-11T13:31:41.071Z",
    "desiredDeliveryDate": null,
    "expectedDeliveryDate": "2017-09-14T22:00:00.000Z",
    "paymentDays": 30,
    "marking": "",
    "deliveryAttention": "",
    "deliveryPhone": "",
    "publicLink": "l0qNw5V8L1uVMoYuHRNf",
    "approvedByName": null,
    "documents": [],
    "purchaseOrderLogEntries": [
      {
        "logDate": "2017-09-11T13:31:08.972Z",
        "_id": "59b6901c1598211831000063",
        "logType": 5,
        "description": "",
        "user": "5f48eb3e65d7ee494649824",
        "userName": "Anna Andersson"
      },
      {
        // ...
      }
    ],
    "invoiceItems": [
      {
        // ...
      }
    ],
    "createDate": "2017-09-11T13:31:08.963Z",
    "projectNumber": "183897"
  }
}

This endpoint retrieves a specific purchase order.

HTTP Request

GET https://app.seventime.se/api/2/purchaseOrders/<_id>

URL Parameters

Parameter Description
_id The _id of the purchase order to retrieve

Create a Purchase Order

curl -X POST "https://app.seventime.se/api/2/purchaseOrders/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"createdByUser":"51718241fdb708f384795682","distributor":"5f6b2e6af24d5df5548672"}' 
let jsonData = {
  createdByUser: '51718241fdb708f384795682',
  distributor: '5f6b2e6af24d5df5548672',
};

let options = {
  url: 'https://app.seventime.se/api/2/purchaseOrders',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.post(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Purchase Order updated: " + body.purchaseOrderName +  ", _id: " + body._id);
  } else {
    console.error("ERROR! Unable to create purchase order: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
  "deliveryAddress":
    { "name": "namn",
      "address": "Ă–stra Gatan 129",
      "address2": "Västra Gatan 921",
      "zipCode": "12345",
      "city": "Stockholm",
      "country": "SE" 
    },
    "invoiceAddress":
    { "name": "namn",
      "address": "Ă–stra Gatan 129",
      "address2": "Västra Gatan 921",
      "zipCode": "12345",
      "city": "Stockholm",
      "country": "SE",
      "email": "email@company.com" 
    },
  "_id": "5fca480e571eb873a548952",
  "createDate": "2020-12-04T14:30:38.164Z",
  "invoiceItems": [],
  "purchaseOrderLogEntries":
    [ 
      { "_id": "5fca480e571eb8747951862",
        "logType": 5,
        "description": "",
        "user": "51714655fbb708f364879528",
        "userName": "Anna Andersson",
        "logDate": "2020-12-04T14:30:38.169Z" 
       } 
     ],
  "documents": [],
  "purchaseOrderName": "purchase Order 123",
  "purchaseOrderInfoName": "purchase order info 123",
  "deliveryAttention": "Anna",
  "deliveryPhone": "123947513",
  "marking": "mark",
  "headerText": "header text",
  "footerText": "footer text",
  "footerInfoText": "footer info text",
  "createdByUser": "51714655fbb708f3124687282",
  "createdByUserName": "Anna Andersson",
  "distributor": "5f6b4b6ef26b5d6f5a687207",
  "distributorName": "UE lev 20200923",
  "distributorAddress": "",
  "distributorVAT": "",
  "ourCustomerNumber": "",
  "language": "EN",
  "ourReference": "51714655fbb704997512356884",
  "ourReferenceName": "Anna Andersson",
  "purchaseOrderStatus": 10,
  "contactPersonDistributor": "5fca0baf099b1c3a54789574286",
  "contactPersonDistributorName": "dwd21",
  "purchaseOrderDate": "2020-12-04T23:00:00.000Z",
  "project": "5b20cce1d59a902e6548795248",
  "projectName": "BlĂ¥sippan",
  "workOrder": "5fb3d3f6d2b1a732b11655248597",
  "workOrderNumber": "4922",
  "workOrderName": "API",
  "desiredDeliveryDate": "2020-12-19T23:00:00.000Z",
  "paymentDays": 5,
  "publicLink": "D2ymDeLqBpsOZdBJNvY",
  "sentDate": "2020-12-04T14:30:38.169Z",
  "purchaseOrderNumber": "1051",
}
"Purchase Order created: name: purchase Order 123, _id: 5fca480e571eb873a548952"

This endpoint creates a purchase order

HTTP Request

POST https://app.seventime.se/api/2/purchaseOrders/

POST Parameters

Parameter Type Required? Description
createdByUser String Yes Id of the user who created the purchase order
distributor String Yes Id of the distributor
language String No Language of the purchase order as a language code, e.g 'SV' for Swedish
purchaseOrderName String No Name of the purchase order. If not specified, this will be set according to the settings
purchaseOrderInfoName String No Name of the info box on the purchase order. This will not be shown on the purchase order when sent
purchaseOrderStatus String No Purchase order status. See below for available statuses
contactPersonDistributor String No Id of the contact person of the distributor
purchaseOrderDate String No Purchase order date in the format 'YYYY-MM-DD'
workOrder String No Id of the work order. The work order will only be shown in the info box and not on the purchase order when sent
project String No Id of the project. The project will only be shown in the info box and not on the purchase order when sent
desiredDeliveryDate String No Desired delivery date
deliveryAddress Object No Contains attributes for delivery address. See below for details
deliveryAttention String No Id of the delivery attention
deliveryPhone String No Phone number of the delivery
invoiceAddress Object No Contains attributes for invoice address. See below for details
marking String No Marking on the purchase order
paymentDays Number No Number of payment days
invoiceItems Array No Array of objects which describe the invoice items on the purchase order. See below for details
headerText String No Header text that will be shown above the invoice rows
footerText String No Footer text that will be shown in the footer
footerInfoText String No Fotter info text that will be shown below the invoice rows

Purchase order statuses

Code Description
1 Draft
2 Sent
3 Obliterated
4 Confirmed
10 Delivered

Attributes for deliveryAddress & invoiceAddress

Parameter Type Required? Description
name String No Name of delivery recipient
address String No Primary address
address2 String No Secondary address
zipCode String No Zip code
city String No City
country String No Country, given as a country code (E.g. SE for Sweden)
phone String No Phone number

Attributes for invoiceItems

The field invoiceItems should be an array containing objects with the attributes shown below

Parameter Type Required? Description
itemType String Yes Item type of invoice row, see below for details
expenseItem String No* Id of the expense. *Required if itemType is expense
timeCategory String No* Id of the time category. *Required if itemType is timelog
numberOfItems Number No Quantity of the item. If not specified, this will be set to 1
unit String No Unit of the item
unitPrice Number No Unit price of the item
pricePerHour Number No Price per hour. Used for time log rows
totalAmount Number No Total amount. Used for onlyamount rows
discountPercent Number No Discount of the item

Item types

This table contains the different item types used in the field invoiceItems.itemTypes

Item type Description
expense Expense row
timeLog Time log row
general Free-text row
blank Blank row
text Text row
onlyamount Text+amount row

Update a Purchase Order

curl -X PUT "https://app.seventime.se/api/2/purchaseOrders/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"5fca480e571eb82548762156","modifiedByUser":"51718241fdb708f3764857952","paymentDays":"10"}' 
let jsonData = {
  _id: '5fca480e571eb82548762156',
  modifiedByUser: '51718241fdb708f3764857952',
  paymentDays: 10
};

let options = {
  url: 'https://app.seventime.se/api/2/purchaseOrders',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.put(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Purchase Order updated: " + body.purchaseOrderName +  ", _id: " + body._id);
  } else {
    console.error("ERROR! Unable to update purchase order: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
  "deliveryAddress":
    { "name": "namn",
      "address": "Ă–stra Gatan 129",
      "address2": "Västra Gatan 921",
      "zipCode": "12345",
      "city": "Stockholm",
      "country": "SE" 
    },
    "invoiceAddress":
    { "name": "namn",
      "address": "Ă–stra Gatan 129",
      "address2": "Västra Gatan 921",
      "zipCode": "12345",
      "city": "Stockholm",
      "country": "SE",
      "email": "email@company.com" 
    },
  "_id": "5fca480e571eb82548762156",
  "createDate": "2020-12-04T14:30:38.164Z",
  "invoiceItems": [],
  "purchaseOrderLogEntries":
    [ 
      { "_id": "5fca480e571eb873a64b97ed",
        "logType": 5,
        "description": "",
        "user": "51714655fbb708f3648975216875",
        "userName": "Anna Andersson",
        "logDate": "2020-12-04T14:30:38.169Z" 
       } 
     ],
  "documents": [],
  "purchaseOrderName": "purchase Order 123",
  "purchaseOrderInfoName": "purchase order info 123",
  "deliveryAttention": "Anna",
  "deliveryPhone": "123947513",
  "marking": "mark",
  "headerText": "header text",
  "footerText": "footer text",
  "footerInfoText": "footer info text",
  "createdByUser": "51714655fbb76487951267",
  "createdByUserName": "Anna Andersson",
  "distributor": "5f6b4b6ef26b5d6f5a687207",
  "distributorName": "UE lev 20200923",
  "distributorAddress": "",
  "distributorVAT": "",
  "ourCustomerNumber": "",
  "language": "EN",
  "ourReference": "51714655fbb708f65498785135",
  "ourReferenceName": "Anna Andersson",
  "purchaseOrderStatus": 10,
  "contactPersonDistributor": "5fca0baf099b1c3167985428",
  "contactPersonDistributorName": "dwd21",
  "purchaseOrderDate": "2020-12-04T23:00:00.000Z",
  "project": "5b20cce1d59a902e2658749821354",
  "projectName": "BlĂ¥sippan",
  "workOrder": "5fb3d3f6d2b1a6789842157",
  "workOrderNumber": "4922",
  "workOrderName": "API",
  "desiredDeliveryDate": "2020-12-19T23:00:00.000Z",
  "paymentDays": 10,
  "publicLink": "D2ymDeLqBpsOzBdduYO",
  "sentDate": "2020-12-04T14:30:38.169Z",
  "purchaseOrderNumber": "1051",
}
"Purchase Order updated: name: purchase Order 123, _id: 5fca480e571eb82548762156"

This endpoint updates a purchase order

HTTP Request

PUT https://app.seventime.se/api/2/purchaseOrders/

PUT Parameters

The table below shows the required fields. Other available fields can be found in the section 'Create a Purchase Order'.

Parameter Type Required? Description
_id String Yes Id of the purchase order
modifiedByUser String Yes Id of the user who modified the purchase order

Delete a Purchase Order

curl -X DELETE "https://app.seventime.se/api/2/purchaseOrders/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"5fca480e571eb8548271985c","deletedByUser":"51203146506d961c098751258"}' 
let jsonData = {
  _id: '5fca480e571eb8548271985c',
  deletedByUser: '51203146506d961c098751258'
};

let options = {
  url: 'https://app.seventime.se/api/2/purchaseOrders',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.delete(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Purchase Order deleted: " + body.purchaseOrderName +  ", _id: " + body._id);
  } else {
    console.error("ERROR! Unable to delete purchase order: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
  "_id": "5fca480e571eb8548271985c",
  "purchaseOrderName": "purchase Order 123",
  "purchaseOrderNumber": "1051",
}
"Purchase Order deleted: name: purchase Order 123, _id: 5fca480e571eb8548271985c"

This endpoint deletes a purchase order

HTTP Request

DELETE https://app.seventime.se/api/2/purchaseOrders/

DELETE Parameters

Parameter Type Required? Description
_id String Yes Id of the purchase order

Quotes

Get Quotes

curl "https://app.seventime.se/api/2/quotes/?limit=5&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/quotes/?limit=5&page=1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 195,
    "totalPages": 98,
    "currentPage": 5
  },
  "data": [
    {
      "_id": "5c33891321361d7d548782561",
      "quoteNumber": "1054",
      "quoteType": 0,
      "quoteName": "Prisindikation",
      "quoteInfoName": "",
      "quoteCategory": null,
      "quoteCategoryName": null,
      "language": "SV",
      "description": null,
      "headerText": null,
      "footerInfoText": null,
      "footerText": "<table width=\"100%\"><tr><td style='vertical-align: top;'>TESTerrt</td><td style='vertical-align: top;'>TEST2</td><td style='vertical-align: top;'>TEST3</td></tr></table>",
      "createdByUser": "5f48eb3e65d7ee494247852",
      "createdByUserName": "Anna Andersson",
      "ourReference": "5f48eb3e65d7ee494247852",
      "ourReferenceName": "Anna Andersson",
      "salesAgent": "5f48eb3e65d7ee494247852",
      "salesAgentName": "Anna Andersson",
      "customer": "5bb26376c42fb99275054892034",
      "customerName": "Company",
      "customerNumber": "44312",
      "customerAddress": "Ă–stra Gatan 129 123 45 Stockholm",
      "customerVAT": "",
      "contactPerson": null,
      "contactPersonName": null,
      "project": null,
      "projectName": null,
      "workOrder": null,
      "workOrderName": "",
      "workOrderNumber": "",
      "quoteDate": "2019-01-07T17:13:55.271Z",
      "validToDate": "2019-02-06T17:13:55.383Z",
      "discountInPercent": 0,
      "totalAmount": 500,
      "totalTaxAmount": 125,
      "totalAmountInclTax": 625,
      "taxPercent": 25,
      "totalCost": 0,
      "useQuoteValue": false,
      "quoteValue": 0,
      "useQuoteCost": false,
      "quoteCost": 0,
      "currencyCode": "SEK",
      "currencyRate": 1,
      "quoteStatus": 3,
      "archived": false,
      "archivedDate": null,
      "deliveryDate": null,
      "deliveryDateEnd": null,
      "sentDate": "2019-01-07T17:15:10.109Z",
      "acceptedDate": "2019-01-07T00:00:00.000Z",
      "rejectedDate": null,
      "invoice": null,
      "invoiceNumber": "",
      "invoicedDate": null,
      "priceList": null,
      "priceListName": "",
      "marking": "",
      "houseDeductionBasisAmount": 0,
      "houseDeductionAmount": 0,
      "enableQuoteConditions": false,
      "quoteConditionsContent": "",
      "multipleTaxesOnRows": false,
      "showPriceInclTaxesOnRows": true,
      "confirmationDate": null,
      "confirmationHeaderText": "Härmed bekräftar vi er beställning enligt specifikationen nedan.",
      "confirmationFooterInfoText": "",
      "confirmationTitle": "Orderbekräftelse",
      "publicLink": "ObLBZZ0wDWcjlzxUwLnD",
      "useBudgetCalculation": false,
      "quoteAcceptReason": null,
      "quoteAcceptReasonName": null,
      "quoteDeclineReason": null,
      "quoteDeclineReasonName": null,
      "notes": "",
      "openNotificationSent": false,
      "quoteTemplate": "5b7dd2ba41cb2a725547911",
      "stockReservationIsDone": false,
      "quoteElements": [
        {
          "_id": "5b7ada8548975216",
          "content": {
            "text": "",
            "confirmationText": ""
          },
          "backgroundColor": "FAFAFA",
          "bottomMargin": 20,
          "topMargin": 20,
          "elementTypeId": 1000,
          "itemId": "0.1735729354019433"
        },
        {
          "_id": "5c25fd4e818921172d237086",
          "content": {
            "invoiceItems": [
              {
                "stockLocation": "5bbd3a49dda6579841241",
                "selectedFlag": false,
                "houseWorkTypeOfWork": 0,
                "houseWorkFlag": false,
                "totalCost": 0,
                "totalAmountInclTax": 0,
                "totalTaxAmount": 0,
                "totalAmount": 500,
                "taxPercent": 25,
                "discountPercent": 0,
                "supplementChargePercent": 0,
                "discountInPercent": 0,
                "unitCost": 0,
                "unit": "Styck",
                "priceListName": null,
                "priceList": null,
                "unitPrice": 100,
                "numberOfItems": "5",
                "machineName": "",
                "machine": null,
                "driverJournalItemTypeName": "",
                "driverJournalItemType": null,
                "expenseItemName": "Company - 5 användare - #2",
                "expenseItem": "5de78aed1332719657d4218b",
                "categoryName": "",
                "timeCategory": null,
                "itemType": "expense",
                "createDate": null,
                "articleNumber": "203",
                "itemOrder": 1024,
                "itemId": "0.29956387071628154",
                "description": "",
                "name": "",
                "_id": null
              }
            ],
            "totalAmount": 500,
            "totalTaxAmount": 125,
            "totalAmountInclTax": 625,
            "taxPercent": 25,
            "totalCost": 0,
            "houseDeductionBasisAmount": 0,
            "houseDeductionAmount": 0,
            "selectableRows": false,
            "showOnlyTotalPrice": false,
            "hiddenColumns": [
              "articleNumber"
            ]
          },
          "backgroundColor": "FAFAFA",
          "bottomMargin": 20,
          "topMargin": 20,
          "elementTypeId": 1200,
          "itemId": "0.086780107201752"
        },
        {
          "_id": "5b7a808bc65798521357",
          "content": {
            "text": "",
            "confirmationText": ""
          },
          "backgroundColor": "FAFAFA",
          "bottomMargin": 20,
          "topMargin": 20,
          "elementTypeId": 1000,
          "itemId": "0.047508293157285886"
        }
      ],
      "budgetCalculation": {
        "invoiceItems": [],
        "totalBenefitAmount": 0,
        "totalCostAmount": 0
      },
      "houseProperties": {
        "typeOfProperty": 1,
        "propertyDescription": "",
        "housingSocietyNumber": "",
        "apartmentNumber": "",
        "maxDeductionAmount": 50000,
        "personalNumber": "",
        "deductionDistribution": []
      },
      "deliveryAddress": {
        "name": "",
        "address": "",
        "address2": "",
        "zipCode": "",
        "city": "",
        "country": "",
        "phone": ""
      },
      "documents": [],
      "quoteLogEntries": [
        {
          "_id": "5c33831c3512857dd314687592",
          "logDate": "2019-01-07T17:15:08.533Z",
          "userName": "Anna Andersson",
          "user": "59312765ad961c6489415",
          "description": "",
          "logType": 1,
          "entryId": "mZjaXWo2oRTr"
        },
        {
          // ...
        }
      ],
      "invoiceItems": [],
      "createDate": "2019-01-07T17:15:08.532Z"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves quotes.

HTTP Request

GET https://app.seventime.se/api/2/quotes

Query Parameters

Parameter Default Description
quoteName If specified, quotes that match the parameter will be included.
quoteNumber If specified, quotes that match the parameter will be included.
fromQuoteDate If specified, invoices with quote date after or on this date will be included. The date has to be in the format 'YYYY-MM-DD'
toQuoteDate If specified, invoices with quote date before or on this date will be included. The date has to be in the format 'YYYY-MM-DD'
fromValidToDate If specified, invoices with valid to date after or on this date will be included. The date has to be in the format 'YYYY-MM-DD'
toValidToDate If specified, invoices with valid to date before or on this date will be included. The date has to be in the format 'YYYY-MM-DD'
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Quote

curl "https://app.seventime.se/api/2/quotes/5c33891321361d7d548782561" \
  -H "Client-Secret: thisismysecretkey" \ 
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/quotes/5c33891321361d7d548782561";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "_id": "5c33891321361d7d548782561",
    "quoteNumber": "1054",
    "quoteType": 0,
    "quoteName": "Prisindikation",
    "quoteInfoName": "",
    "quoteCategory": null,
    "quoteCategoryName": null,
    "language": "SV",
    "description": null,
    "headerText": null,
    "footerInfoText": null,
    "footerText": "<table width=\"100%\"><tr><td style='vertical-align: top;'>TESTerrt</td><td style='vertical-align: top;'>TEST2</td><td style='vertical-align: top;'>TEST3</td></tr></table>",
    "createdByUser": "5f48eb3e65d7ee497412582",
    "createdByUserName": "Anna Andersson",
    "ourReference": "5f48eb3e65d7ee497412582",
    "ourReferenceName": "Anna Andersson",
    "salesAgent": "5f48eb3e65d7ee497412582",
    "salesAgentName": "Anna Andersson",
    "customer": "5bb26376c42fb9965479852",
    "customerName": "Company",
    "customerNumber": "44312",
    "customerAddress": "Ă–stra Gatan 129 123 45 Stockholm",
    "customerVAT": "",
    "contactPerson": null,
    "contactPersonName": null,
    "project": null,
    "projectName": null,
    "workOrder": null,
    "workOrderName": "",
    "workOrderNumber": "",
    "quoteDate": "2019-01-07T17:13:55.271Z",
    "validToDate": "2019-02-06T17:13:55.383Z",
    "discountInPercent": 0,
    "totalAmount": 500,
    "totalTaxAmount": 125,
    "totalAmountInclTax": 625,
    "taxPercent": 25,
    "totalCost": 0,
    "useQuoteValue": false,
    "quoteValue": 0,
    "useQuoteCost": false,
    "quoteCost": 0,
    "currencyCode": "SEK",
    "currencyRate": 1,
    "quoteStatus": 3,
    "archived": false,
    "archivedDate": null,
    "deliveryDate": null,
    "deliveryDateEnd": null,
    "sentDate": "2019-01-07T17:15:10.109Z",
    "acceptedDate": "2019-01-07T00:00:00.000Z",
    "rejectedDate": null,
    "invoice": null,
    "invoiceNumber": "",
    "invoicedDate": null,
    "priceList": null,
    "priceListName": "",
    "marking": "",
    "houseDeductionBasisAmount": 0,
    "houseDeductionAmount": 0,
    "enableQuoteConditions": false,
    "quoteConditionsContent": "",
    "multipleTaxesOnRows": false,
    "showPriceInclTaxesOnRows": true,
    "confirmationDate": null,
    "confirmationHeaderText": "Härmed bekräftar vi er beställning enligt specifikationen nedan.",
    "confirmationFooterInfoText": "",
    "confirmationTitle": "Orderbekräftelse",
    "publicLink": "ObLBZZ0wDWcjlxzUbYtLL",
    "useBudgetCalculation": false,
    "quoteAcceptReason": null,
    "quoteAcceptReasonName": null,
    "quoteDeclineReason": null,
    "quoteDeclineReasonName": null,
    "notes": "",
    "openNotificationSent": false,
    "quoteTemplate": "5b7dd2ba41cb2a725879452815",
    "stockReservationIsDone": false,
    "quoteElements": [
      {
        "_id": "5b7ada8bc41cb365284975",
        "content": {
          "text": "",
          "confirmationText": ""
        },
        "backgroundColor": "FAFAFA",
        "bottomMargin": 20,
        "topMargin": 20,
        "elementTypeId": 1000,
        "itemId": "0.1735729354019433"
      },
      {
        "_id": "5c25fd4e8189211798574952",
        "content": {
          "invoiceItems": [
            {
              "stockLocation": "5bbd3a49dda7dbc364978521",
              "selectedFlag": false,
              "houseWorkTypeOfWork": 0,
              "houseWorkFlag": false,
              "totalCost": 0,
              "totalAmountInclTax": 0,
              "totalTaxAmount": 0,
              "totalAmount": 500,
              "taxPercent": 25,
              "discountPercent": 0,
              "supplementChargePercent": 0,
              "discountInPercent": 0,
              "unitCost": 0,
              "unit": "Styck",
              "priceListName": null,
              "priceList": null,
              "unitPrice": 100,
              "numberOfItems": "5",
              "machineName": "",
              "machine": null,
              "driverJournalItemTypeName": "",
              "driverJournalItemType": null,
              "expenseItemName": "Company - 5 användare - #2",
              "expenseItem": "5de78aed13327196587954283",
              "categoryName": "",
              "timeCategory": null,
              "itemType": "expense",
              "createDate": null,
              "articleNumber": "203",
              "itemOrder": 1024,
              "itemId": "0.29956387071628154",
              "description": "",
              "name": "",
              "_id": null
            }
          ],
          "totalAmount": 500,
          "totalTaxAmount": 125,
          "totalAmountInclTax": 625,
          "taxPercent": 25,
          "totalCost": 0,
          "houseDeductionBasisAmount": 0,
          "houseDeductionAmount": 0,
          "selectableRows": false,
          "showOnlyTotalPrice": false,
          "hiddenColumns": [
            "articleNumber"
          ]
        },
        "backgroundColor": "FAFAFA",
        "bottomMargin": 20,
        "topMargin": 20,
        "elementTypeId": 1200,
        "itemId": "0.086780107201752"
      },
      {
        "_id": "5b7a808bc413665478512",
        "content": {
          "text": "",
          "confirmationText": ""
        },
        "backgroundColor": "FAFAFA",
        "bottomMargin": 20,
        "topMargin": 20,
        "elementTypeId": 1000,
        "itemId": "0.047508293157285886"
      }
    ],
    "budgetCalculation": {
      "invoiceItems": [],
      "totalBenefitAmount": 0,
      "totalCostAmount": 0
    },
    "houseProperties": {
      "typeOfProperty": 1,
      "propertyDescription": "",
      "housingSocietyNumber": "",
      "apartmentNumber": "",
      "maxDeductionAmount": 50000,
      "personalNumber": "",
      "deductionDistribution": []
    },
    "deliveryAddress": {
      "name": "",
      "address": "",
      "address2": "",
      "zipCode": "",
      "city": "",
      "country": "",
      "phone": ""
    },
    "documents": [],
    "quoteLogEntries": [
      {
        "_id": "5c33831c351285769857452542",
        "logDate": "2019-01-07T17:15:08.533Z",
        "userName": "Anna Andersson",
        "user": "59312765ad961c036598758245",
        "description": "",
        "logType": 1,
        "entryId": "mZjaXWo2oRTr"
      },
      {
        // ...
      }
    ],
    "invoiceItems": [],
    "createDate": "2019-01-07T17:15:08.532Z"
  }
}

This endpoint retrieves a specific quote.

HTTP Request

GET https://app.seventime.se/api/2/quotes/<_id>

URL Parameters

Parameter Description
_id The _id of the quote to retrieve

Get Quote Templates

curl "https://app.seventime.se/api/2/quoteTemplates" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/quoteTemplates/?";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "_id": "5fb02816ed7ed72d965987485",
      "columnContents": [
        "This is a new footer!<br><br>"
      ],
      "templateName": "Standard utan sektioner",
      "quoteType": 0,
      "language": "",
      "createdByUser": "5f48eb3e65d7ee49425485982",
      "createdByUserName": "Anna Andersson",
      "createDate": "2020-11-09T13:31:10.929Z",
      "documents": [],
      "quoteElements": [
        {
          "_id": "5b7a808bc41cb2a778985478541",
          "itemId": "0.2991772478801382",
          "elementTypeId": 1400,
          "topMargin": 20,
          "bottomMargin": 20,
          "backgroundColor": "FAFAFA",
          "content": null
        }
      ],
      "overrideFooter": false,
      "footerText": "<table width=\"100%\"><tr><td style='vertical-align: top;'>This is a new footer!<br><br></td></tr></table>",
      "footerNumOfCols": 1,
      "overrideLogoAndAddress": false,
      "logo": [
        {
          "_id": "5f6b5b15468263005f54793258",
          "createDate": "2020-09-23T14:26:29.655Z",
          "modifiedDate": "2020-09-23T14:26:29.655Z",
          "name": "logo.png",
          "contentType": "image/png",
          "size": 6765,
          "user": "5f48eb3e65d7ee468748512546",
          "userName": "Anna Andersson"
        }
      ],
      "logotypeWidth": 200,
      "logoPosition": "left",
      "quoteAddress": "<b>Företaget</b><div>Gatan</div><div>12345 Staden</div>"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves quote templates.

HTTP Request

GET https://app.seventime.se/api/2/quoteTemplates

Query Parameters

Parameter Default Description
templateName If specified, quote templates that match the parameter will be included.
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get Quote Categories

curl "https://app.seventime.se/api/2/quoteCategories" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/quoteCategories/?";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "_id": "58a678badc33073a42215684",
      "isActive": true,
      "quoteCategoryName": "Utbildning"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves quote categories.

HTTP Request

GET https://app.seventime.se/api/2/quoteCategories

Query Parameters

Parameter Default Description
quoteCategoryName If specified, quote categories that match the parameter will be included.
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Result Units

Get Result Units

curl "https://app.seventime.se/api/2/resultUnits" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/resultUnits";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "_id": "57076abe8010bd225413654",
      "name": "Kontor Syd",
      "code": "Syd",
      "isActive": true,
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves purchase orders.

HTTP Request

GET https://app.seventime.se/api/2/resultUnits

Query Parameters

Parameter Default Description
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Result Unit

curl "https://app.seventime.se/api/2/resultUnits/57076abe8010bd225413654" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/resultUnits/57076abe8010bd225413654";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "_id": "57076abe8010bd225413654",
    "name": "Kontor Syd",
    "code": "Syd",
    "isActive": true,
  }
}

This endpoint retrieves a specific result unit.

HTTP Request

GET https://app.seventime.se/api/2/resultUnits/<_id>

URL Parameters

Parameter Description
_id The _id of the result unit to retrieve

Supplement Orders

Get Supplement Orders

curl "https://app.seventime.se/api/2/supplementOrders/?project=5f924f4f533f102a4898752" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/supplementOrders/?project=5f924f4f533f102a4898752";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 1,
    "totalPages": 1,
    "currentPage": 1
  },
  "data": [
    {
      "_id": "5ba5619ad77ca8741398752",
      "title": "Discount",
      "description": "",
      "headerText": "",
      "supplementOrderNumber": 1,
      "supplementOrderType": 1,
      "createdByUser": "5f48eb3e65d7ee46897851326584",
      "createdByUserName": "Anna Andersson",
      "customer": "5bb26376c42fb99469875216",
      "customerName": "Company AB",
      "project": "5f924f4f5335794216587",
      "projectName": "BlĂ¥sippan",
      "projectNumber": "17058",
      "totalAmount": 75,
      "totalTaxAmount": 18.75,
      "totalAmountInclTax": 94,
      "taxPercent": 25,
      "contractedAmount": 0,
      "priceList": null,
      "priceListName": "",
      "billingMethod": "FIXED_PRICE",
      "acceptedDate": null,
      "acceptedWithSignature": false,
      "signaturePath": "",
      "deviation": null,
      "deviationNumber": 0,
      "publicLink": "B2R8LWK5bakdBtTuWv7",
      "footerText": "<table width=\"100%\"><tr><td style='vertical-align: top;'></td><td style='vertical-align: top;'></td><td style='vertical-align: top;'></td></tr></table>",
      "deviations": [],
      "supplementOrderLogEntries": [
        {
          "logType": 1,
          "description": "",
          "user": "5f48eb3e65d7ee4945798521",
          "userName": "Anna Andersson",
          "_id": "5ba5619ad77ca8791257284",
          "logDate": "2018-09-25T07:12:46.369Z"
        },
        {
        // ...
        }
      ],
      "documents": [],
      "workOrderIds": [
        "5bae34dca878bd79245168547"
      ],
      "invoiceIds": [
        "5f62c5281715836a49878521",
        "524f29251c11237389745654"
      ],
      "invoiceItems": [
        {
          "_id": null,
          "name": "",
          "description": "",
          "itemId": "0.9440031314948534",
          "itemOrder": 1024,
          "articleNumber": "203",
          "itemType": "expense",
          "timeCategory": null,
          "categoryName": "",
          "expenseItem": "5266af51d887512654897852",
          "expenseItemName": "Company - 5 användare - #2",
          "driverJournalItemType": null,
          "driverJournalItemTypeName": "",
          "machine": null,
          "machineName": "",
          "numberOfItems": 1,
          "unitPrice": 100,
          "priceList": null,
          "priceListName": null,
          "unit": "Styck",
          "unitCost": 0,
          "discountInPercent": 0,
          "supplementChargePercent": -25,
          "discountPercent": 0,
          "taxPercent": 25,
          "totalAmount": 75,
          "totalTaxAmount": 0,
          "totalAmountInclTax": 0,
          "totalCost": 0,
          "houseWorkFlag": false,
          "houseWorkTypeOfWork": 0,
          "selectedFlag": false,
          "createDate": null
        },
        {
        // ...
        }
      ],
      "modifiedDate": null,
      "createDate": "2018-09-25T07:12:46.369Z",
      "status": 60,
    }
  ]
}

This endpoint retrieves supplement orders.

HTTP Request

GET https://app.seventime.se/api/2/supplementOrders/?project=5f924f4f533f102a4898752

Query Parameters

Parameter Default Description
project Id of the project that supplement orders will be retrieved from. This parameter is required
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Supplement Order

curl "https://app.seventime.se/api/2/supplementOrders/5ba5619ad77ca879794258752" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/supplementOrders/5ba5619ad77ca879794258752";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
      "_id": "5ba5619ad77ca879794258752",
      "title": "Discount",
      "description": "",
      "headerText": "",
      "supplementOrderNumber": 1,
      "supplementOrderType": 1,
      "createdByUser": "5f48eb3e65d7ee4942659852",
      "createdByUserName": "Anna Andersson",
      "customer": "5bb26376c42fb98755218",
      "customerName": "Company AB",
      "project": "5f924f4f533f102af65897421",
      "projectName": "BlĂ¥sippan",
      "projectNumber": "17058",
      "totalAmount": 75,
      "totalTaxAmount": 18.75,
      "totalAmountInclTax": 94,
      "taxPercent": 25,
      "contractedAmount": 0,
      "priceList": null,
      "priceListName": "",
      "billingMethod": "FIXED_PRICE",
      "acceptedDate": null,
      "acceptedWithSignature": false,
      "signaturePath": "",
      "deviation": null,
      "deviationNumber": 0,
      "publicLink": "B2R8LWK5bakDbUTDnzX",
      "footerText": "<table width=\"100%\"><tr><td style='vertical-align: top;'></td><td style='vertical-align: top;'></td><td style='vertical-align: top;'></td></tr></table>",
      "deviations": [],
      "supplementOrderLogEntries": [
        {
          "logType": 1,
          "description": "",
          "user": "5f48eb3e65d7ee49489741358",
          "userName": "Anna Andersson",
          "_id": "5ba5619ad77ca8791257284",
          "logDate": "2018-09-25T07:12:46.369Z"
        },
        {
        // ...
        }
      ],
      "documents": [],
      "workOrderIds": [
        "5bae34dca878bd7909852125"
      ],
      "invoiceIds": [
        "5f62c5281715836a42185872",
        "524f29251c112373a3215652"
      ],
      "invoiceItems": [
        {
          "_id": null,
          "name": "",
          "description": "",
          "itemId": "0.9440031314948534",
          "itemOrder": 1024,
          "articleNumber": "203",
          "itemType": "expense",
          "timeCategory": null,
          "categoryName": "",
          "expenseItem": "5266af51d887512879216458",
          "expenseItemName": "Company - 5 användare - #2",
          "driverJournalItemType": null,
          "driverJournalItemTypeName": "",
          "machine": null,
          "machineName": "",
          "numberOfItems": 1,
          "unitPrice": 100,
          "priceList": null,
          "priceListName": null,
          "unit": "Styck",
          "unitCost": 0,
          "discountInPercent": 0,
          "supplementChargePercent": -25,
          "discountPercent": 0,
          "taxPercent": 25,
          "totalAmount": 75,
          "totalTaxAmount": 0,
          "totalAmountInclTax": 0,
          "totalCost": 0,
          "houseWorkFlag": false,
          "houseWorkTypeOfWork": 0,
          "selectedFlag": false,
          "createDate": null
        },
        {
        // ...
        }
      ],
      "modifiedDate": null,
      "createDate": "2018-09-25T07:12:46.369Z",
      "status": 60,
   }
}

This endpoint retrieves a specific supplement order.

HTTP Request

GET https://app.seventime.se/api/2/supplementOrder/<_id>

URL Parameters

Parameter Description
_id The _id of the supplement order to retrieve

Supplier Invoices

Get supplier invoices

curl "https://app.seventime.se/api/2/supplierInvoices/?limit=5&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/supplierInvoices/?limit=5&page=1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 29,
    "totalPages": 10,
    "currentPage": 1
  },
  "data": [
    {
      "_id": "5f62c5281715836a472254821",
      "isInvoiceable": false,
      "isInvoiced": false,
      "selfBillingTimeLogIds": [
        "5f5f6881241b6f02a6218724",
        "5f5f6881241b6f02a6879518"
      ],
      "selfBillingExpenseIds": [
        "5f5f8c6a5b2317286e285721",
        "5f5f8c6a5b2317286e698574"
      ],
      "invoiceItems": [
        {
          "_id": "5f60c501271935b912215879",
          "createDate": "2020-09-15T13:44:06.569Z",
          "articleNumber": "",
          "description": "Beredskap normal",
          "itemId": "0.949579694947744",
          "itemOrder": 1024,
          "unitCost": 550,
          "unitPrice": 550,
          "numberOfItems": 4,
          "totalAmount": 2200,
          "unit": "st",
          "taxPercent": 25,
          "totalAmountInclTax": 2750,
          "totalTaxAmount": 550,
          "totalCost": 2090,
          "itemType": "time",
          "timeCategory": "5e81d33db3f1cb30a16489572",
          "categoryName": "Beredskap normal"
        },
        {
          // ...
        }
      ],
      "documents": [],
      "distributor": "5f48eb7105b8ed6934398752",
      "distributorName": "20200828",
      "yourReference": "Anna Andersson",
      "createDate": "2020-09-15T13:44:06.566Z",
      "invoiceDate": "2020-09-15T13:44:06.566Z",
      "paymentDate": null,
      "totalAmount": 7681.7,
      "totalTaxAmount": 1920.425,
      "totalAmountInclTax": 9533.925,
      "taxPercent": 25,
      "taxType": 1,
      "markupPercent": 0,
      "currencyCode": "SEK",
      "currencyRate": 1,
      "OCR": "",
      "economySystemStatus": 0,
      "expensesCreatedFromInvoiceItems": false,
      "notes": "Självfaktura",
      "isCreditInvoice": false,
      "creditForInvoiceNumber": "",
      "isBooked": false,
      "economySystemRef": "",
      "importedFrom": "",
      "supplierInvoiceStatus": 5,
      "workOrder": "5f4df1793751c0916136489752",
      "workOrderTitle": "Ă…terkommande 20200116 - 234556565656",
      "workOrderNumber": 4737,
      "project": null,
      "projectName": null,
      "supplementOrderId": null,
      "supplementOrderNumber": null,
      "customer": "5bb26376c42fb992716598742",
      "customerName": "Company",
      "department": null,
      "departmentName": "",
      "supplementOrder": false,
      "invoice": null,
      "invoiceNumber": "9316",
      "isSelfBillingInvoice": true,
      "selfBillingInvoiceStatus": 1,
      "exportedToEconomy": false,
      "selfBillingInvoice": "5f5f23fd716176146859257",
      "selfBillingInvoiceNumber": "24272",
      "footerText": "<table width=\"100%\"><tr><td style='vertical-align: top;'>Första</td><td style='vertical-align: top;'>Andra</td><td style='vertical-align: top;'>Tredje</td></tr></table>",
      "footerInfoText": "Text under..."
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves supplier invoices.

HTTP Request

GET https://app.seventime.se/api/2/supplierInvoices

Query Parameters

E.g. https://app.seventime.se/api/2/supplierInvoices/?supplierInvoiceNumber=9316

Parameter Default Description
supplierInvoiceNumber If specified, supplier invoices that match the parameter will be included.
supplierInvoiceStatus If specified, supplier invoices that match the parameter will be included.
project If specified, supplier invoices that match the parameter will be included.
customer If specified, supplier invoices that match the parameter will be included.
workOrder If specified, supplier invoices that match the parameter will be included.
workOrderNumber If specified, supplier invoices that match the parameter will be included.
distributor If specified, supplier invoices that match the parameter will be included.
fromInvoiceDate If specified, supplier invoices that match the parameter will be included.
toInvoiceDate If specified, supplier invoices that match the parameter will be included.
isInvoiceable If specified, supplier invoices that match the parameter will be included.
isSelfBillingInvoice If specified, supplier invoices that match the parameter will be included.
exportedToEconomy If specified, supplier invoices that match the parameter will be included.
lastModified If specified, time logs that has been modified since the specified timestamp will be included. Accepted formats: 'YYYY-MM-HH HH:MM', 'YYYY-MM-HH HH:MM:SS', 'YYYY-MM-HHTHH:MM', 'YYYY-MM-HHTHH:MM:SS'
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Supplier Invoice

curl "https://app.seventime.se/api/2/supplierInvoices/5f62c528171548657d215a785" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/supplierInvoices/5f62c528171548657d215a785";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "_id": "5f62c528171548657d215a785",
    "isInvoiceable": false,
    "isInvoiced": false,
    "selfBillingTimeLogIds": [
      "5f5f6881241b6f0221457985",
      "5f5f6881241b6f02a6364619"
    ],
    "selfBillingExpenseIds": [
      "5f5f8c6a5b2317286eb65482b",
      "5f5f8c6a5b2317286eb8d76b1"
    ],
    "invoiceItems": [
      {
        "_id": "5f60c501271935b9165897451",
        "createDate": "2020-09-15T13:44:06.569Z",
        "articleNumber": "",
        "description": "Beredskap normal",
        "itemId": "0.949579694947744",
        "itemOrder": 1024,
        "unitCost": 550,
        "unitPrice": 550,
        "numberOfItems": 4,
        "totalAmount": 2200,
        "unit": "st",
        "taxPercent": 25,
        "totalAmountInclTax": 2750,
        "totalTaxAmount": 550,
        "totalCost": 2090,
        "itemType": "time",
        "timeCategory": "5e81d33db3f1cb30a2135842",
        "categoryName": "Beredskap normal"
      },
      {
        // ...
      }
    ],
    "documents": [],
    "distributor": "5f48eb7105b8ed6969875258",
    "distributorName": "20200828",
    "yourReference": "Anna Andersson",
    "createDate": "2020-09-15T13:44:06.566Z",
    "invoiceDate": "2020-09-15T13:44:06.566Z",
    "paymentDate": null,
    "totalAmount": 7681.7,
    "totalTaxAmount": 1920.425,
    "totalAmountInclTax": 9533.925,
    "taxPercent": 25,
    "taxType": 1,
    "markupPercent": 0,
    "currencyCode": "SEK",
    "currencyRate": 1,
    "OCR": "",
    "economySystemStatus": 0,
    "expensesCreatedFromInvoiceItems": false,
    "notes": "Självfaktura",
    "isCreditInvoice": false,
    "creditForInvoiceNumber": "",
    "isBooked": false,
    "economySystemRef": "",
    "importedFrom": "",
    "supplierInvoiceStatus": 5,
    "workOrder": "5f4df1793751c0916134687952",
    "workOrderTitle": "Ă…terkommande 20200116 - 234556565656",
    "workOrderNumber": 4737,
    "project": null,
    "projectName": null,
    "supplementOrderId": null,
    "supplementOrderNumber": null,
    "customer": "5bb26376c42fb91357498542",
    "customerName": "Company",
    "department": null,
    "departmentName": "",
    "supplementOrder": false,
    "invoice": null,
    "invoiceNumber": "9316",
    "isSelfBillingInvoice": true,
    "selfBillingInvoiceStatus": 1,
    "exportedToEconomy": false,
    "selfBillingInvoice": "5f5f23fd7161713589748562",
    "selfBillingInvoiceNumber": "24272",
    "footerText": "<table width=\"100%\"><tr><td style='vertical-align: top;'>Första</td><td style='vertical-align: top;'>Andra</td><td style='vertical-align: top;'>Tredje</td></tr></table>",
    "footerInfoText": "Text under...",
  }
}

This endpoint retrieves a specific supplier invoice.

HTTP Request

GET https://app.seventime.se/api/2/supplierInvoices/<_id>

URL Parameters

Parameter Description
_id The _id of the supplier invoice to retrieve

Create a Supplier Invoice

curl -X POST "https://app.seventime.se/api/2/supplierInvoices/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"supplierInvoiceNumber":"9162","createdByUser":"5f48eb3e65d7e12574952d685","distributor":"5f6b2e6af24d5d69784521","totalAmountInclTax":"100000"}' 
let jsonData = {
  supplierInvoiceNumber: 9162,
  createdByUser: '5f48eb3e65d7e12574952d685',
  distributor: '5f6b2e6af24d5d69784521',
  totalAmountInclTax: 100000
};

let options = {
  url: 'https://app.seventime.se/api/2/supplierInvoices',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.post(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
  } else {
    console.error("ERROR! Unable to create supplier invoice: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
  "isInvoiceable": true,
  "selfBillingTimeLogIds": [],
  "selfBillingExpenseIds": [],
  "_id": "5fd0619c739154975825",
  "invoiceItems": [],
  "documents": [],
  "supplierInvoiceLogEntries": [ 
    { 
      "_id": "5fdd142c621b21a10129",
      "logType": 1,
      "description": "",
      "user": "5f48eb3e65d7e12574952d685",
      "userName": "Anna Andersson",
      "logDate": "2020-12-09T12":43":51.516Z" 
    } 
  ],
  "markupPercent": 0,
  "distributor": "5f6b2e6af24d5d69784521",
  "distributorName": "Company AB",
  "supplierInvoiceNumber": "9162",
  "invoiceDate": "2020-12-09T12:43:51.515Z",
  "dueDate": "2020-12-09T12:43:51.515Z",
  "totalAmountInclTax": 100000,
  "taxPercent": 25,
  "totalAmount": 80000,
  "totalTaxAmount": 20000,
  "totalAmountToInvoice": 80000,
  "supplierInvoiceStatus": 1,
  "createDate": "2020-12-09T12:43:51.515Z",
}

This endpoint creates a supplier invoice

HTTP Request

POST https://app.seventime.se/api/2/supplierInvoices/

POST Parameters

Parameter Type Required? Description
supplierInvoiceNumber Number Yes Number of the supplier invoice
createdByUser String Yes Id of the user who created the supplier invoice
distributor String Yes Id of the distributor
totalAmountInclTax Number Yes Total amount incl. tax on the supplier invoice
customer String No Id of the customer
project String No Id of the project
workOrder String No Id of the work order. The work order must belong to the specified project
resultUnit String No Id of the result unit
supplierInvoiceStatus Number No Status of the supplier invoice. 1 for 'Registered', 5 for 'Draft', 7 for 'Sent' and 10 for 'Invoiced'
taxPercent Number No Tax on the supplier invoice as a percentage. Ex: 25 for 25% tax
markupPercent Number No Markup on the supplier invoice as a percentage. Ex: 10 for 10% markup
invoiceDate String No Invoice date in the format 'YYYY-MM-DD'
dueDate String No Due date in the format 'YYYY-MM-DD'
exportedToEconomy Boolean No Is the supplier invoice exported to a economy system?
OCR Number No OCR number of the invoice
currencyCode String No Currency code to be used on the supplier invoice
currencyRate Number No* Currency rate between SEK and the selected currency. *Required if currencyCode is not 'SEK'. This will always be set to 1 if currencyCode is 'SEK'
supplementOrder Boolean No Should the supplier invoice be a supplement order? This is only available if the project or work order is set to use a fixed price
supplementOrderId String No Id of the supplement order
ourReference String No Our reference
yourReference String No Your reference
notes String No Notes on the supplier invoice
isInvoiceable Boolean No Is the supplier invoice invoiceable?
invoiceItems Array No Array containing objects with invoice items. See below for details.

Attributes for invoiceItems

The field invoiceItems should be an array containing objects with the attributes shown below

Parameter Type Required? Description
itemType String Yes Item type of invoice row, see below for details
expenseItem String No* Id of the expense. *Required if itemType is expense
timeCategory String No* Id of the time category. *Required if itemType is timelog
machine String No* Id of the machine. *Required if itemType is machineTimeLog
driverJournalItemType String No* Id of the driver journal. *Required if itemType is driverJournal
numberOfItems Number No Quantity of the item. If not specified, this will be set to 1
unit String No Unit of the item
unitCost Number No Purchase price of the item
unitPrice Number No Unit price of the item
pricePerHour Number No Price per hour. Used for time log rows
totalAmount Number No Total amount. Used for onlyamount rows
discountPercent Number No Discount of the item

Item types

This table contains the different item types used in the field invoiceItems.itemTypes

Item type Description
expense Expense row
timeLog Time log row
general Free-text row
blank Blank row
text Text row
onlyamount Text+amount row
machineTimeLog Machine time log row
driverJournal Driver journal row

Update a Supplier Invoice

curl -X POST "https://app.seventime.se/api/2/supplierInvoices/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"5fd0619c739154975825","modifiedByUser":"5f48eb3e65d7ee4942c6859741","supplierInvoiceStatus":"7"}' 
let jsonData = {
  _id: "5fd0619c739154975825",
  modifiedByUser: '5f48eb3e65d7ee4942c6859741',
  supplierInvoiceStatus: 10
};

let options = {
  url: 'https://app.seventime.se/api/2/supplierInvoices',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.put(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Supplier invoice updated: _id: " + body._id);

  } else {
    console.error("ERROR! Unable to update supplier invoice: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
  "isInvoiceable": true,
  "selfBillingTimeLogIds": [],
  "selfBillingExpenseIds": [],
  "_id": "5fd0619c739154975825",
  "invoiceItems": [],
  "documents": [],
  "supplierInvoiceLogEntries": [ 
    { 
      "_id": "5fdd142c621b649785231",
      "logType": 1,
      "description": "",
      "user": "5f48eb3e65d7ee897425862",
      "userName": "Anna Andersson",
      "logDate": "2020-12-09T12":43":51.516Z" 
    } 
  ],
  "markupPercent": 0,
  "distributor": "5f6b2e6af24d5df697845268",
  "distributorName": "Company AB",
  "supplierInvoiceNumber": "9162",
  "invoiceDate": "2020-12-09T12:43:51.515Z",
  "dueDate": "2020-12-09T12:43:51.515Z",
  "totalAmountInclTax": 100000,
  "taxPercent": 25,
  "totalAmount": 80000,
  "totalTaxAmount": 20000,
  "totalAmountToInvoice": 80000,
  "supplierInvoiceStatus": 10,
  "createDate": "2020-12-09T12:43:51.515Z",
}
"Supplier invoice updated: _id: 5fd0619c739154975825"

This endpoint updates a supplier invoice

HTTP Request

PUT https://app.seventime.se/api/2/supplierInvoices/

PUT Parameters

The table below shows the required fields. Other available fields can be found in the section 'Create an Invoice'.

Parameter Type Required? Description
_id String Yes Id of the Supplier Invoice
modifiedByUser String Yes Id of the user who made the change

Delete a Supplier Invoice

curl -X DELETE "https://app.seventime.se/api/2/supplierInvoices/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"5fd0619c739154975825","deletedByUser":"51203146506d961c03649852317"}' 
let jsonData = {
  _id: "5fd0619c739154975825",
  deletedByUser: "51203146506d961c03649852317"
};

let options = {
  url: 'https://app.seventime.se/api/2/supplierInvoices',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.delete(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Supplier invoice updated: _id: " + body._id + ', number: ' + body.supplierInvoiceNumber);

  } else {
    console.error("ERROR! Unable to delete supplier invoice: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
  "_id": "5fd0619c739154975825",
  "supplierInvoiceNumber": "9162",
}
"Supplier invoice deleted: _id: 5fd0619c739154975825, number: 9162"

This endpoint deletes a supplier invoice

HTTP Request

DELETE https://app.seventime.se/api/2/supplierInvoices/

DELETE Parameters

Parameter Type Required? Description
_id String Yes Id of the Supplier Invoice

Time Logs

Get Time Logs

curl "https://app.seventime.se/api/2/timeLogs/?limit=3&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/timeLogs/?limit=3&page=1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 1182,
    "totalPages": 394,
    "currentPage": 1
  },
  "data": [
    {
      "_id": "514959f8733259db75648975215",
      "allDay": false,
      "cost": 10690.5824,
      "createDate": "2013-03-16T11:39:36.437Z",
      "customer": null,
      "description": "",
      "endTimestamp": "2013-03-16T11:39:35.000Z",
      "isWorkTime": true,
      "project": null,
      "status": 1,
      "time": 41.18577972222222,
      "timeCategory": null,
      "timestamp": "2013-03-14T18:28:26.193Z",
      "user": "51203146506d961c030798526587",
      "userName": "Anna Andersson",
      "invoiceableTime": 41.18577972222222,
      "customFields": [],
      "isInvoiceable": true,
      "isInvoiced": false,
      "machineTimePrices": [],
      "machineTimeSupplements": [],
      "realTimestamp": "2020-08-27T07:52:57.685Z",
      "startLocation": {
        "coordinates": [],
        "type": "Point"
      },
      "stopLocation": {
        "coordinates": [],
        "type": "Point"
      },
      "unSocialHoursCosts": [
        {
          "_id": "5f57385dbe6f05476e5923541",
          "salaryType": "58cb7f24e9c363d0b0a1258984",
          "salaryTypeName": "OB kväll",
          "costPerHour": 150,
          "time": 6
        },
        {
          "_id": "5f57385dbe6f054764875216",
          "salaryType": "58cb7f24e9c363d0b689847a",
          "salaryTypeName": "OB kväll",
          "costPerHour": 150,
          "time": 10.5261325
        }
      ]
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves time logs (and absences if the punch clock module is not used). The attribute "isAbsence" will be true for absences.

HTTP Request

GET https://app.seventime.se/api/2/timeLogs

Query Parameters

Parameter Default Description
user If specified, time logs that match the parameter will be included.
customer If specified, time logs that match the parameter will be included.
project If specified, time logs that match the parameter will be included.
task If specified, time logs that match the parameter will be included.
category If specified, time logs that match the parameter will be included.
workOrder If specified, time logs that match the parameter will be included.
workOrderNumber If specified, time logs that match the parameter will be included.
timestamp If specified, time logs that start after the given date and time will be included. Accepted formats: 'YYYY-MM-HH HH:MM', 'YYYY-MM-HH HH:MM:SS', 'YYYY-MM-HHTHH:MM', 'YYYY-MM-HHTHH:MM:SS'
endTimestamp If specified, time logs that end before the given date and time will be included. Accepted formats: 'YYYY-MM-HH HH:MM', 'YYYY-MM-HH HH:MM:SS', 'YYYY-MM-HHTHH:MM', 'YYYY-MM-HHTHH:MM:SS'
invoicedDate If specified, time logs with invoice date since the specified timestamp will be included. Accepted formats: 'YYYY-MM-HH HH:MM', 'YYYY-MM-HH HH:MM:SS', 'YYYY-MM-HHTHH:MM', 'YYYY-MM-HHTHH:MM:SS'
isAbsence If specified, time logs that is of "absence type" will be included.
lastModified If specified, time logs that has been modified since the specified timestamp will be included. Accepted formats: 'YYYY-MM-HH HH:MM', 'YYYY-MM-HH HH:MM:SS', 'YYYY-MM-HHTHH:MM', 'YYYY-MM-HHTHH:MM:SS'
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Time Log

curl "https://app.seventime.se/api/2/timeLogs/514959f8733259db45897213548" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/timeLogs/514959f8733259db45897213548";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "startLocation": {
      "type": "Point",
      "coordinates": []
    },
    "stopLocation": {
      "type": "Point",
      "coordinates": []
    },
    "allDay": false,
    "status": 1,
    "isInvoiceable": true,
    "isInvoiced": false,
    "_id": "514959f8733259db45897213548",
    "cost": 10690.5824,
    "createDate": "2013-03-16T11:39:36.437Z",
    "customer": null,
    "description": "",
    "endTimestamp": "2013-03-16T11:39:35.000Z",
    "isWorkTime": true,
    "project": null,
    "time": 41.18577972222222,
    "timeCategory": null,
    "isAbsence": false,
    "timestamp": "2013-03-14T18:28:26.193Z",
    "user": "51203146506d961c030248975612",
    "userName": "Anna Andersson",
    "invoiceableTime": 41.18577972222222,
    "customFields": [],
    "machineTimePrices": [],
    "machineTimeSupplements": [],
    "realTimestamp": "2020-08-27T07:52:57.685Z",
    "unSocialHoursCosts": [
      {
        "_id": "5f57385dbe6f05368974521",
        "salaryType": "58cb7f24e9c363d4589761258",
        "salaryTypeName": "OB kväll",
        "costPerHour": 150,
        "time": 6
      },
      {
        "_id": "5f57385dbe6f054765879125",
        "salaryType": "58cb8f2e9c663d0e68482a",
        "salaryTypeName": "OB kväll",
        "costPerHour": 150,
        "time": 10.5261325
      }
    ]
  }
}

This endpoint retrieves a specific time log.

HTTP Request

GET https://app.seventime.se/api/2/timeLogs/<_id>

URL Parameters

Parameter Description
_id The _id of the time log to retrieve

Get Time Categories

curl "https://app.seventime.se/api/2/timeCategories" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/timeCategories/?";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "_id": "58cd3c4771b8a3c34658974521",
      "name": "Semester",
      "description": "",
      "isAbsenceType": true,
      "isUnsocialHour": false,
      "isInvoiceable": true,
      "pricePerHour": 0,
      "articleNumber": "040",
      "isWorkTime": true,
      "isActive": true,
      "color": "FF9800",
      "isVacation": true,
      "presenceCode": "",
      "requirePreAttest": true,
      "isMachineTime": false
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves time categories.

HTTP Request

GET https://app.seventime.se/api/2/timeCategories

Query Parameters

Parameter Default Description
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Time Category

curl "https://app.seventime.se/api/2/timeCategories/58cd3c4771b8a3c34658974521" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/timeCategories/58cd3c4771b8a3c34658974521";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "_id": "58cd3c4771b8a3c34658974521",
    "name": "Semester",
    "description": "",
    "isAbsenceType": true,
    "isUnsocialHour": false,
    "isInvoiceable": true,
    "pricePerHour": 0,
    "articleNumber": "040",
    "isWorkTime": true,
    "isActive": true,
    "color": "FF9800",
    "isVacation": true,
    "presenceCode": "",
    "requirePreAttest": true,
    "isMachineTime": false
  }
}

This endpoint retrieves a specific time category.

HTTP Request

GET https://app.seventime.se/api/2/timeCategories/<_id>

URL Parameters

Parameter Description
_id The _id of the time category to retrieve

Create a Time Log

curl -X POST "https://app.seventime.se/api/2/timeLogs/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"createdByUser":"5f48eb3e65d7ee4926574851","user":"51203146506d961c03036589741","timestamp":"2020-06-05 12:00","time":"5"}'
let jsonData = {
  createdByUser: '5f48eb3e65d7ee4926574851',
  user: '51203146506d961c03036589741',
  timestamp: '2020-06-05 12:00',
  time: '5'
};

let options = {
  url: 'https://app.seventime.se/api/2/timeLogs',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.post(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
  } else {
    console.error("ERROR! Unable to create time log: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
  "startLocation": { type: 'Point', coordinates: [] },
  "stopLocation": { type: 'Point', coordinates: [] },
  "allDay": false,
  "status": 1,
  "isInvoiceable": true,
  "isInvoiced": false,
  "_id": "5fbcfe75ba9312280e2145897521",
  "timestamp": "2020-11-19T12:00:00.000Z",
  "realTimestamp": "2020-11-19T12:00:00.000Z",
  "createDate": "2020-11-24T12:37:09.258Z",
  "unSocialHoursCosts": [],
  "customFields": [],
  "machineTimePrices": [],
  "machineTimeSupplements": [],
  "user": "51203146506d961c03036589741",
  "userName": "Anna Andersson",
  "endTimestamp": "2020-11-19T17:00:00.000Z",
  "realEndTimestamp": "2020-11-19T17:00:00.000Z",
  "time": 5,
  "invoiceableTime": 5,
  "pricePerHour": 777,
  "price": 777
}

This endpoint creates a time log

HTTP Request

POST https://app.seventime.se/api/2/timeLogs/

POST Parameters

Parameter Type Required? Description
createdByUser String Yes Id of the user who created the time log
user String Yes Id of the user on the time log
timestamp String Yes Starting date and time for the time log. Accepted formats: 'YYYY-MM-HH HH:MM', 'YYYY-MM-HH HH:MM:SS', 'YYYY-MM-HHTHH:MM', 'YYYY-MM-HHTHH:MM:SS'
endTimestamp String No* Starting date and time for the time log. Accepted formats: 'YYYY-MM-HH HH:MM', 'YYYY-MM-HH HH:MM:SS', 'YYYY-MM-HHTHH:MM', 'YYYY-MM-HHTHH:MM:SS'. *This is required if field 'time' is not specified
time String No* Time of the time log in hours. *This is required if field 'endTimestamp' is not specified
invoiceableTime String No Invoiceable time. If not specified, this will be set to the time of the time log
customer String No Id of the customer
project String No Id of the project
timeCategory String No Id of the time category
workOrder String No Id of the work order
pricePerHour Number No price per hour of the time log. If not specified, the price will be set according to the user, customer, project, time category or work order.
description String No Description/notes of the time log
internalDescription String No Internal description/notes of the time log
supplementOrder Boolean No Is the time log a supplement order?
isInvoiceable Boolean No Invoiceable ot not
isAbsence Boolean No Should be set to true if it is an absence

Update a Time Log

curl -X PUT "https://app.seventime.se/api/2/timeLogs/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"5fbcfe75ba9312280e2145897521","modifiedByUser":"51718241fdb708f3923268","user":"51203146506d961c03036589741","timestamp":"2020-10-7 07:00","endTimestamp":"2020-10-7 15:00"}'
let jsonData = {
  _id: '5fbcfe75ba9312280e2145897521',
  modifiedByUser: '51718241fdb708f3923268',
  user: '51203146506d961c03036589741',
  timestamp: '2020-10-07 07:00',
  endTimestamp: '2020-10-07 15:00',
};

let options = {
  url: 'https://app.seventime.se/api/2/timeLogs',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.put(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Time log updated: _id: " + body._id);
  } else {
    console.error("ERROR! Unable to update time log: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
  "startLocation": { type: 'Point', coordinates: [] },
  "stopLocation": { type: 'Point', coordinates: [] },
  "allDay": false,
  "status": 1,
  "isInvoiceable": true,
  "isInvoiced": false,
  "isAbsence": false,
  "_id": "5fbcfe75ba9312280e2145897521",
  "timestamp": "2020-10-07T06:00:00.000Z",
  "realTimestamp": "2020-10-07T06:00:00.000Z",
  "createDate": "2020-11-24T12:37:09.258Z",
  "unSocialHoursCosts": [],
  "customFields": [],
  "machineTimePrices": [],
  "machineTimeSupplements": [],
  "user": "51203146506d961c03036589741",
  "userName": "Anna Andersson",
  "endTimestamp": "2020-10-07T014:00:00.000Z",
  "realEndTimestamp": "2020-10-07T14:00:00.000Z",
  "time": 8,
  "invoiceableTime": 8,
  "pricePerHour": 777,
  "price": 777
}
"Time log updated: _id: 5fbcfe75ba9312280ef6523e"

This endpoint updates a time log

HTTP Request

PUT https://app.seventime.se/api/2/timeLogs/

PUT Parameters

The table below shows the required fields. Other available fields can be found in the section 'Create a Time Log'.

Parameter Type Required? Description
_id String Yes Id of the time log
modifiedByUser String Yes Id of the user who made the change
user String Yes Id of the user on the time log

Delete a Time Log

curl -X DELETE "https://app.seventime.se/api/2/timeLogs/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"51203146506d961c35798485","deletedByUser":"51203146506d961c03036589741"}'
let jsonData = {
  _id: '51203146506d961c35798485',
  deletedByUser: '51203146506d961c03036589741'
};

let options = {
  url: 'https://app.seventime.se/api/2/timeLogs',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.delete(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Time log deleted: _id: " + body._id);
  } else {
    console.error("ERROR! Unable to delete time log: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
  "_id": "51203146506d961c35798485"
}
"Time log deleted: _id: 51203146506d961c35798485"

This endpoint deletes a time log

HTTP Request

DELETE https://app.seventime.se/api/2/timeLogs/

DELETE Parameters

Parameter Type Required? Description
_id String Yes Id of the time log

Users

Get Users

curl "https://app.seventime.se/api/2/users/?limit=10&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/users/?limit=100&page=1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 4712,
    "totalPages": 48,
    "currentPage": 3
  },
  "data": [
    {
      "_id": "5f48eb3e65d7ee49469874512",
      "firstName": "Anna",
      "lastName": "Andersson",
      "email": "email@company.com",
      "personalNumber": "",
      "employeeNumber": "",
      "userName": "Anna",
      "workPhone": "",
      "cellPhone": "",
      "createdDate": "2020-08-28T11:32:14.452Z",
      "modifiedDate": "2020-08-28T11:33:36.675Z",
      "userRoleId": 10,
      "isActive": true,
      "isActivated": true,
      "language": "SV",
      "workSchedules": [
        {
          "_id": "5e9565f2103b932af29dff7d",
          "startDate": "2020-03-01T00:00:00.000Z",
          "endDate": "2020-05-30T00:00:00.000Z",
          "workSchedule": "5e9565ew103b932af29dcc5f"
        },
        {
          "_id": "62ff8cbf16a40777f0166e86",
          "startDate": "2020-06-01T00:00:00.000Z",
          "endDate": null,
          "workSchedule": "512406dfiua296a124000003"
        }
      ],
      "canHaveDynamicSchedule": false
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves users.

HTTP Request

GET https://app.seventime.se/api/2/users

Query Parameters

E.g. https://app.seventime.se/api/2/users/?name=Anna Andersson

Parameter Default Description
name If specified, users that match the parameter will be included.
personNumber If specified, users that match the parameter will be included.
department If specified, users that match the parameter will be included.
userRole If specified, users that match the parameter will be included.
isActive If specified, users that match the parameter will be included. This must be a boolean
isActivated If specified, users that match the parameter will be included. This must be a boolean
defaultSalaryType If specified, users that match the parameter will be included.
userSkills If specified, users that match the parameter will be included.
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific User

curl "https://app.seventime.se/api/2/users/5f48eb3e65d7ee49469874512" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/users/5f48eb3e65d7ee49469874512";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data":
  {
    "_id": "5f48eb3e65d7ee49469874512",
    "firstName": "Anna",
    "lastName": "Andersson",
    "email": "email@company.com",
    "personalNumber": "",
    "employeeNumber": "2",
    "userName": "Anna",
    "workPhone": "1234-123456",
    "cellPhone": "070-4580425",
    "createdDate": "2013-02-06T16:18:40.588Z",
    "modifiedDate": "2020-11-16T10:39:01.762Z",
    "userRoleId": 30,
    "isActive": true,
    "isActivated": true,
    "language": "EN",
    "workSchedules": [
      {
        "_id": "5e9565f2103b932af29dff7d",
        "startDate": "2020-03-01T00:00:00.000Z",
        "endDate": "2020-05-30T00:00:00.000Z",
        "workSchedule": "5e9565ew103b932af29dcc5f"
      },
      {
        "_id": "62ff8cbf16a40777f0166e86",
        "startDate": "2020-06-01T00:00:00.000Z",
        "endDate": null,
        "workSchedule": "512406dfiua296a124000003"
      }
    ],
    "canHaveDynamicSchedule": false
  }
}

This endpoint retrieves a specific user

HTTP Request

GET https://app.seventime.se/api/2/users/<_id>

URL Parameters

Parameter Description
_id The _id of the user to retrieve

Get User Roles

curl "https://app.seventime.se/api/2/userRoles/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/userRoles/";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "userRoleId": 1,
      "userRoleName": "Administratör"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves user roles.

HTTP Request

GET https://app.seventime.se/api/2/userRoles/

URL Parameters

Parameter Default Description
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get User Salary types

curl "https://app.seventime.se/api/2/defaultSalaryTypes/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/defaultSalaryTypes/";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "_id": "5834419c7a27db69365897412",
      "name": "Ă–vertid",
      "description": "",
      "code": "123",
      "isAbsenceTimeType": false,
      "isRuleType": false,
      "absenceTimeCategory": null,
      "absenceTimeCategoryName": "",
      "unitType": "1",
      "canBeRegistered": true,
      "salaryAmount": 0,
      "typeInSalarySystem": 10
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves user salary types.

HTTP Request

GET https://app.seventime.se/api/2/defaultSalaryTypes/

URL Parameters

Parameter Default Description
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get User Skills

curl "https://app.seventime.se/api/2/userSkills/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/userSkills/";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "_id": "59f9d1c53ffd5f93226978451",
      "skillTitle": "Höga arbeten",
      "requireEducations": [
        "5a54ea1f7a7fe3c212569874852"
      ]
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves user skills.

HTTP Request

GET https://app.seventime.se/api/2/userSkills/

URL Parameters

Parameter Default Description
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get User Work Types

curl "https://app.seventime.se/api/2/userWorkTypes/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/userWorkTypes/";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "_id": "5f442181e62efdb4a3126597412",
      "name": "Programmerare",
      "pricePerHour": 555,
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves user roles.

HTTP Request

GET https://app.seventime.se/api/2/userRoles/

URL Parameters

Parameter Default Description
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Create a User

curl -X POST "https://app.seventime.se/api/2/users/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"createdByUser":"5f48eb3e65d7ee49421258981","firstName":"Anna","lastName":"Andersson","email":"email@company.com","userName":"AnnaA","userRolesId":1"}'
let jsonData = {
  createdByUser: '5f48eb3e65d7ee49421258981',
  firstName: 'Anna',
  lastName: 'Andersson',
  email: 'email@company.com',
  userName: 'AnnaA',
  userRoleId: 1,
};

let options = {
  url: 'https://app.seventime.se/api/2/users',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.post(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
  } else {
    console.error("ERROR! Unable to create user: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{
  "_id": "5f48eb3e65d7ee49421258981",
  "firstName": "Anna",
  "lastName": "Andersson",
  "email": "email@company.com",
  "personalNumber": "",
  "employeeNumber": "",
  "userName": "AnnaA",
  "workPhone": "",
  "cellPhone": "",
  "createdDate": "2020-11-17T14:42:31.533Z",
  "modifiedDate": "2020-11-17T14:42:31.533Z",
  "userRoleId": 1,
  "isActive": false,
  "isActivated": false,
  "language": "SV"
}

This endpoint creates a user.

HTTP Request

POST https://app.seventime.se/api/2/users/

POST Parameters

Parameter Type Required? Description
createdByUser String Yes Id of the user who created the new user
firstName String Yes First name of the user
lastName String Yes Last name of the user
email String Yes Email of the user
userName String Yes Username
userRoleId String Yes User role id
employeeNumber String No EmployeeNumber
workPhone String No Work phone number
cellPhone String No Cell phone number
isActive Boolean No Should the user be active?
isActivated Boolean No Should the user be activated?
password String No Password of the user
language String No Language of the user as a language code (e.g SV for Swedish). If not specified, this will we set to SV.

Update a User

curl -X PUT "https://app.seventime.se/api/2/users/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"5fb3e157f795553d0575597841","modifiedByUser":"5f48eb3e65d7ee4942645d21","firstName":"Anna","lastName":"Andersson","userName":"AnnaA"}' 
let jsonData = {
  _id: '5fb3e157f795553d0575597841',
  modifiedByUser: '5f48eb3e65d7ee4942645d21',
  firstName: 'Anna',
  lastName: 'Andersson',
  userName: 'AnnaA'
};

let options = {
  url: 'https://app.seventime.se/api/2/users',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.put(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("User updated: " + body.firstName + ", _id: " + body._id);
  } else {
    console.error("ERROR! Unable to update user: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{
  "_id": "5fb3e157f795553d0575597841",
  "firstName": "Anna",
  "lastName": "Andersson",
  "email": "email@company.com",
  "userName": "AnnaA",
  "createdDate": "2020-11-17T14:42:31.533Z",
  "modifiedDate": "2020-12-11T13:25:07.332Z",
  "userRoleId": 1,
  "isActive": true,
  "isActivated": false,
  "language": "SV"
}
"User updated: Anna, _id: 5fb3e157f795553d0575597841"

This endpoint updates a specific user.

HTTP Request

PUT https://app.seventime.se/api/2/users/

PUT Parameters

The table below shows the required fields. Other available fields can be found in the section 'Create a User'.

Parameter Type Required? Description
_id String Yes Id of the user
modifiedByUser String Yes Id of the user who made the change

Vehicles

Get Vehicles

curl "https://app.seventime.se/api/2/vehicles/?limit=5&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/vehicles/?limit=5&page=1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }  
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 28,
    "totalPages": 6,
    "currentPage": 2
  },
  "data": [
    {
      "_id": "55782f0382da2f8544689751",
      "name": "Audi Q8",
      "registrationNumber": "ABC123",
      "isActive": true,
      "createDate": "2016-06-08T14:45:42.546Z",
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves vehicles.

HTTP Request

GET https://app.seventime.se/api/2/vehicles

Query Parameters

Parameter Default Description
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Vehicles

curl "https://app.seventime.se/api/2/vehicles/55782f0382da2f8544689751" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/vehicles/55782f0382da2f8544689751";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "_id": "55782f0382da2f8544689751",
    "name": "Audi Q8",
    "registrationNumber": "ABC123",
    "isActive": true,
    "createDate": "2016-06-07T13:20:04.346Z",
  }
}

This endpoint retrieves a specific vehicle.

HTTP Request

GET https://app.seventime.se/api/2/vehicle/<_id>

URL Parameters

Parameter Description
_id The _id of the vehicle to retrieve

Work Orders

Get Work Orders

curl "https://app.seventime.se/api/2/workOrders/?limit=10&page=1" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/workOrders/?limit=10&page1";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "meta": {
    "totalResources": 1772,
    "totalPages": 355,
    "currentPage": 34
  },
  "data": [
    {
      "_id": "5bae34dca878bd790d0498751",
      "workOrderNumber": 2901,
      "createdByUserName": "Anna Andersson",
      "createdByUser": "59312765ad961c0311358974",
      "statusRef": "587f3157c73c0f6d9c568741",
      "status": 100,
      "customerNumber": "511",
      "customerName": "Kund #1",
      "customer": "571f61330c7f498a269751242",
      "estimatedTime": 0,
      "endDate": "2017-10-12T16:00:00.000Z",
      "startDate": "2017-10-10T07:00:00.000Z",
      "description": "",
      "title": "AO1",
      "customFields": [],
      "tags": [],
      "workOrderUserWorkTypes": [],
      "workOrderUserSkills": [],
      "budgetCalculation": {
        "invoiceItems": []
      },
      "invoiceRows": [],
      "todoItems": [],
      "reminders": [],
      "checkLists": [],
      "documents": [],
      "locationCoordinates": [],
      "workAddress": {
        "useOtherAddress": false,
        "address": "",
        "zipCode": "",
        "city": ""
      },
      "comments": [],
      "partTimeResources": [],
      "machines": [],
      "users": [],
      "createDate": "2018-09-28T13:17:16.785Z"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves work orders.

HTTP Request

GET https://app.seventime.se/api/2/workOrders

Query Parameters

E.g. https://app.seventime.se/api/2/workOrders/?workOrderNumber=5555

Parameter Default Description
title If specified, work orders that match the parameter will be included.
workOrderNumber If specified, work orders that match the parameter will be included.
project If specified, work orders that match the parameter will be included.
user If specified, work orders that match the parameter will be included.
customer If specified, work orders that match the parameter will be included.
lastModified If specified, work orders that has been modified since the specified timestamp will be included. Accepted formats: 'YYYY-MM-HH HH:MM', 'YYYY-MM-HH HH:MM:SS', 'YYYY-MM-HHTHH:MM', 'YYYY-MM-HHTHH:MM:SS'
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get a specific Work order

curl "https://app.seventime.se/api/2/workOrders/5bae34dca878b5497748" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/workOrders/5bae34dca878b5497748";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "workAddress": {
      "useOtherAddress": false,
      "address": "",
      "zipCode": "",
      "city": ""
    },
    "budgetCalculation": {
      "invoiceItems": []
    },
    "locationCoordinates": [],
    "tags": [],
    "_id": "5bae34dca878b5497748",
    "workOrderNumber": 2901,
    "createdByUserName": "Anna Andersson",
    "createdByUser": "59312765ad961c0365978421",
    "statusRef": "587f3157c73c0f6d9125897451",
    "status": 100,
    "customerNumber": "511",
    "customerName": "Kund #1",
    "customer": "571f61330c7f498a216975841",
    "estimatedTime": 0,
    "endDate": "2017-10-12T16:00:00.000Z",
    "startDate": "2017-10-10T07:00:00.000Z",
    "description": "",
    "title": "AO1",
    "customFields": [],
    "workOrderUserWorkTypes": [],
    "workOrderUserSkills": [],
    "invoiceRows": [],
    "todoItems": [],
    "reminders": [],
    "checkLists": [],
    "documents": [],
    "comments": [],
    "partTimeResources": [],
    "machines": [],
    "users": [],
    "createDate": "2018-09-28T13:17:16.785Z",
    "relations": []
  }
}

This endpoint retrieves a specific work order.

HTTP Request

GET https://app.seventime.se/api/2/workOrders/<_id>

URL Parameters

Parameter Description
_id The _id of the work order to retrieve

Get work order types

curl "https://app.seventime.se/api/2/workOrderTypes/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/workOrderTypes/";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "_id": "58263d936a17605a25689741",
      "isActive": true,
      "workOrderTypeName": "Extra",
      "color": "f44336"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves work order types.

HTTP Request

GET https://app.seventime.se/api/2/workOrderTypes/

URL Parameters

Parameter Default Description
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get work order tags

curl "https://app.seventime.se/api/2/workOrderTags/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/workOrderTags/";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "_id": "5df3a401f0690d1db659741",
      "tagName": "1",
      "color": "FAFAFA"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves work order tags.

HTTP Request

GET https://app.seventime.se/api/2/workOrderTags/

URL Parameters

Parameter Default Description
sortBy If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending

Get Work order statuses

curl "https://app.seventime.se/api/2/workOrderStatuses/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/workOrderStatuses/";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "_id": "582f7cabd16fdb974185235",
      "statusName": "Ej planerad",
      "color": "FF5722",
      "inProgressStatus": false,
      "closedStatus": false,
      "isActive": true,
      "plannedStatus": false
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves work order statuses.

HTTP Request

GET https://app.seventime.se/api/2/workOrderStatuses/

URL Parameters

No parameters

Create a Work order

curl -X POST "https://app.seventime.se/api/2/workOrders/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"title":"Support","customer":"571f61330c7f49451685","createdByUser":"5912626016d971c03069712"}' 
let jsonData = {
  title: 'Support',
  customer: '571f61330c7f49451685',
  createdByUser: '5912626016d971c03069712'
};

let options = {
  url: 'https://app.seventime.se/api/2/workOrders',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request.post(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
  } else {
    console.error("ERROR! Unable to create work order: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
    "title": "Support"
    "workOrderNumber": 4908,       
    "description": "",   
    "locationCoordinates": [],
    "tags": [],
    "_id": "5fb8517e1bcaad1cd6987451",
    "createDate": "2020-11-16T10:15:42.216Z",
    "users": [],
    "machines": [],
    "partTimeResources": [],
    "comments": [],
    "documents": [],
    "checkLists": [],
    "reminders": [],
    "todoItems": [],
    "invoiceRows": [],
    "workOrderUserSkills": [],
    "workOrderUserWorkTypes": [],
    "customFields": [],
    "relations": [],
    "estimatedTime": 0, 
    "marking": "",
    "yourOrderNumber": "",
    "customerName": "Company AB",
    "customer": "571f61330c7f498a64978511",
    "color": "FF5722",
    "status": 500,
    "statusRef": "587f7dadd10fbbe338000055",
    "createdByUser": "5912626016d971c03069712",
    "createdByUserName": "Anna Andersson",
}

This endpoint creates a work order.

HTTP Request

POST https://app.seventime.se/api/2/workOrders/

POST Parameters

Parameter Type Required? Description
title String Yes Title of the work order
customer String Yes Customer id for the customer who the work order should belong to
createdByUser String Yes Id of the user who created the work order
statusRef String No Id of the status of the work order.
Project String No Project id for the project which the work order should belong to
startDate String No Start date for the work order. The format must be YYYY-MM-DD HH:MM
endDate String No End date for the work order. The format must be YYYY-MM-DD HH:MM
currentOwner String No Id of the user who is the current owner of the work order
users Array No Array containing the ids of users who are working full time on the work order
machines Array No Array containing the ids of the machines which are working full time on the work order
estimatedTime Number No Estimated time required to finish the work order
contactPerson String No Id of the contact person
workOrderType String No Id of the work order type
department String No Id of the department
workLeader String No Id of the work leader
description String No Description of the work order
color String No Color of the work order, only used if "How to set color" is 'Manually' in settings. See below for available colors
invoiceStatus Number No Invoice status of the work order. See below for available statuses
billingMethod String No Billing method of work order. See below for available billing methods
fixedPrice Number No* *Only if Billing method is set to FIXED_PRICE
isSupplementOrder Boolean No Should the work order be set as supplement order?
workAddress Object No Contains attributes for work address. If not specified, the customers address will be set as work address. See below for details
enablePortalAccess Boolean No Should the work order be available in the customer portal?
allowRegistrationOfTimes Boolean No Should it be possible to register times on the work order?
allowRegistrationOfExpenses Boolean No Should it be possible to register expenses on the work order?
marking String No Marking on the work order
yourOrderNumber String No Your order number of the work order

Colors for work orders

     - 9c27b0
     - 673ab7
     - 7C4DFF
     - 3F51B5
     - 3a87ad

     - 2196F3
     - 03A9F4
     - 00BCD4
     - 009688
     - 468847

     - 4CAF50
     - 8BC34A
     - CDDC39
     - FF9800
     - FF5722

     - f44336
     - e91e63
     - 795548
     - 5D4037
     - 999999

     - 666666
     - 333333
     - 000000
     - FAFAFA

Invoice statuses for work orders

Code Status
0 None
5 Not invoiceable
10 Ready to be invoiced
20 Partly invoiced
30 Fully invoiced

Billing methods for work orders

Code Billing method
RUNNING Running price
FIXED_PRICE Fixed price
ACCORDING_TO_QUOTE Price will be set according to quote

Attributes for workAddress

Parameter Type Required? Description
useOtherAddress Boolean Yes Should an alternative work address be used?
name String No Used if useSeparateBillingAddress is true
address String No Used if useSeparateBillingAddress is true
address2 String No Used if useSeparateBillingAddress is true
zipCode String No Used if useSeparateBillingAddress is true
city String No Used if useSeparateBillingAddress is true
country String No Used if useSeparateBillingAddress is true, given as a country code (E.g. SE for Sweden)
phone String No Used if useSeparateBillingAddress is true

Update a Work order

curl -X PUT "https://app.seventime.se/api/2/workOrders/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"5fb8517e1bcaad1cd69875412","modifiedByUser":"5f48eb3e65d7e987513654","title":"Construction work"}' 
let jsonData = {
  _id: '5fb8517e1bcaad1cd69875412',
  modifiedByUser: '5f48eb3e65d7e987513654',
  title: 'Construction work'
};

let options = {
  url: 'https://app.seventime.se/api/2/workOrders',
  json: jsonData,
  headers: {
    "Client-Secret": "thisismysecretkey",
    'Content-Type': 'application/json',
    'Accept': 'application/json'
  }
};

request.put(options, function (error, response, body) {
  if (!error && response.statusCode === 200) {
    console.log(body);
    console.log("Work Order updated: " + body.title + ", _id: " + body._id);
  } else {
    console.error("ERROR! Unable to update work order: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
  "runningInvoiceSettings":
   { 
     "oneRowText": "Arbetsorder #{{workOrderNumber}} {{workOrderTitle}}",
     "timeLogMachineSupplement": "nothing",
     "timeLogCustomField": "nothing",
     "includeDescription": true,
     "includeDateRange": false,
     "includeDate": true,
     "includeUser": true,
     "machineFromTimeLog": false,
     "includeCategory": true,
     "includeTask": false,
     "includeWorkOrder": false,
     "includeProject": false,
     "formatType": "detailedFormat" 
   },
  "budgetCalculation": { "invoiceItems": [] },
  "locationCoordinates": [],
  "tags": [],
  "_id": "5fb8517e1bcaad1cd26497821",
  "createDate": "2020-12-14T14:39:40.951Z",
  "users": [],
  "machines": [],
  "partTimeResources": [],
  "comments": [],
  "documents": [],
  "checkLists": [],
  "reminders":
   [ { "_id": "5321507b60913236597511",
       "reminderTimeType": 4,
       "reminderTimeValue": 10,
       "reminderType": 1,
       "itemId": "0.2819101621862501" } ],
  "todoItems": [],
  "invoiceRows": [],
  "workOrderUserSkills": [],
  "workOrderUserWorkTypes": [],
  "customFields": [],
  "relations": [],
  "title": "Construction work",
  "estimatedTime": 0,
  "description": "",
  "marking": "",
  "yourOrderNumber": "",
  "customerName": "Company",
  "customer": "571f61330c7f498a2d987841",
  "color": "FAFAFA",
  "status": 100,
  "statusRef": "582f7cabd16fdbe985147",
  "createdByUser": "5f48eb3e65d7ee987854125",
  "createdByUserName": "Anna Andersson",
  "workOrderNumber": 4942,
  "completedByUser": null,
  "completedByUserName": "",
  "completedDate": null,
  "inProgressByUser": null,
  "inProgressByUserName": "",
  "inProgressDate": null,
  "modifiedByUser": "5f48eb3e65d7e987513587",
  "modifiedByUserName": "Anna Andersson",
  "modifiedDate": "2020-12-14T14:43:29.158Z" 
}
"Work Order updated: Construction work, _id: 5fb8517e1bcaad1cd26497821"

This endpoint updates a work order.

HTTP Request

PUT https://app.seventime.se/api/2/workOrders/

PUT Parameters

The table below shows the required fields. Other available fields can be found in the section 'Create a Work Order'.

Parameter Type Required? Description
_id String Yes Id of the work order
modifiedByUser String Yes Id of the user who updated the work order

Work schedules

Get Work schedules

curl "https://app.seventime.se/api/2/workSchedules" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/workSchedules";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": [
      {
        "_id": "512406df88a296a124000106",
        "name": "Heltid",
        "description": "100%",
        "isActive": true,
        "workScheduleWeeks": [
          {
            "workScheduleDays": [
              {
                "breaks": [
                  {
                    "breakStartHour": 12,
                    "breakEndHour": 13
                  }
                ],
                "numberOfWorkHours": 8,
                "startHour": 7,
                "endHour": 16
              },
              {
                "breaks": [
                  {
                    "breakStartHour": 12,
                    "breakEndHour": 13
                  }
                ],
                "numberOfWorkHours": 8,
                "startHour": 7,
                "endHour": 16
              },
              {
                "breaks": [
                  {
                    "breakStartHour": 12,
                    "breakEndHour": 13
                  }
                ],
                "numberOfWorkHours": 8,
                "startHour": 7,
                "endHour": 16
              },
              {
                "breaks": [
                  {
                    "breakStartHour": 12,
                    "breakEndHour": 13
                  }
                ],
                "numberOfWorkHours": 8,
                "startHour": 7,
                "endHour": 16
              },
              {
                "breaks": [
                  {
                    "breakStartHour": 12,
                    "breakEndHour": 13
                  }
                ],
                "numberOfWorkHours": 8,
                "startHour": 7,
                "endHour": 16
              },
              {
                "breaks": [],
                "numberOfWorkHours": 0,
                "startHour": 0,
                "endHour": 0
              },
              {
                "breaks": [],
                "numberOfWorkHours": 0,
                "startHour": 0,
                "endHour": 0
              }
            ],
            "numberOfWorkHours": 40
          }
        ]
      },
      {
        // ...
      }
  ]
}

This endpoint retrieves work schedules.

HTTP Request

GET https://app.seventime.se/api/2/workSchedules


The array workScheduleDays holds the info for different days, monday to sunday. I.e. workScheduleDays[0] is monday and workScheduleDays[6] is sunday.

Get a specific WorkSchedule

curl "https://app.seventime.se/api/2/workSchedules/59d05abdc471b72e4979135" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/workSchedules/59d05abdc471b72e4979135";
let options = {
  url: url,
  headers: {
    "Client-Secret": "thisismysecretkey",
    "Content-Type": "application/json",
    "Accept": 'application/json'
  }
};

request(options, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    let info = JSON.parse(body);
    // ...
  } else {
    console.error("Error when calling API! HTTP Code: " + response.statusCode + ", Error message: " + body.errorMessage);
  }
});

The above command returns JSON structured like this:

{
  "data": {
    "_id": "512406df88a296b124000106",
    "name": "Heltid",
    "description": "100%",
    "isActive": true,
    "workScheduleWeeks": [
      {
        "workScheduleDays": [
          {
            "breaks": [
              {
                "breakStartHour": 12,
                "breakEndHour": 13
              }
            ],
            "numberOfWorkHours": 8,
            "startHour": 7,
            "endHour": 16
          },
          {
            "breaks": [
              {
                "breakStartHour": 12,
                "breakEndHour": 13
              }
            ],
            "numberOfWorkHours": 8,
            "startHour": 7,
            "endHour": 16
          },
          {
            "breaks": [
              {
                "breakStartHour": 12,
                "breakEndHour": 13
              }
            ],
            "numberOfWorkHours": 8,
            "startHour": 7,
            "endHour": 16
          },
          {
            "breaks": [
              {
                "breakStartHour": 12,
                "breakEndHour": 13
              }
            ],
            "numberOfWorkHours": 8,
            "startHour": 7,
            "endHour": 16
          },
          {
            "breaks": [
              {
                "breakStartHour": 12,
                "breakEndHour": 13
              }
            ],
            "numberOfWorkHours": 8,
            "startHour": 7,
            "endHour": 16
          },
          {
            "breaks": [],
            "numberOfWorkHours": 0,
            "startHour": 0,
            "endHour": 0
          },
          {
            "breaks": [],
            "numberOfWorkHours": 0,
            "startHour": 0,
            "endHour": 0
          }
        ],
        "numberOfWorkHours": 40
      }
    ]
  }
}

This endpoint retrieves a specific work schedule.

HTTP Request

GET https://app.seventime.se/api/2/workSchedules/<_id>

URL Parameters

Parameter Description
_id The _id of the work schedule to retrieve