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.

For time logs, expenses, invoices, machine time logs, driver journals, purchase orders and work orders, the count is capped at 2000 for performance reasons, and the meta property contains some additional fields:

Some of these endpoints (driver journals, expenses, machine time logs and purchase orders) return HTTP 422 if no filter is given.

{
  "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 production 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, e.g. a required field is missing, a parameter has an invalid value, or the 'Content-Type' header is not 'application/json' on a non-GET request.
401 Unauthorized -- Your API key is wrong, or the user connected to a personal API key is no longer active.
403 Forbidden -- The API key (or the user connected to a personal API key) does not have permission to access the resource.
404 Not Found -- The specified resource could not be found.
422 Unprocessable Entity -- The list query has no filters and could match a very large number of records (code: "QUERY_TOO_BROAD"). Add a filter, e.g. a date range.
429 Too Many Requests -- The rate limit has been exceeded. See 'Rate-limit'.
500 Internal Server Error -- We had a problem with our server. Note that many validation errors that occur when creating or updating a resource are also returned with HTTP 500 and a descriptive errorMessage.
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.

Analytics

The analytics endpoints return aggregated data, e.g. hours per customer and month or invoiced amount per project, without having to fetch and sum every single object.

All analytics endpoints work the same way. You send a POST request with a JSON body that specifies a date range, what to group by and which metrics to calculate. The available groupings, metrics, date fields and filters differ per resource and are listed under each endpoint below.

Get Time Log Analytics

curl -X POST "https://app.seventime.se/api/2/analytics/timeLogs" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"fromDate":"2024-01-01","toDate":"2024-03-31","groupBy":["customer","month"],"metrics":["hours","revenue"],"sort":{"metric":"hours","direction":"desc"},"limit":20}'
let jsonData = {
  fromDate: '2024-01-01',
  toDate: '2024-03-31',
  groupBy: ['customer', 'month'],
  metrics: ['hours', 'revenue'],
  sort: {
    metric: 'hours',
    direction: 'desc'
  },
  limit: 20
};

let options = {
  url: 'https://app.seventime.se/api/2/analytics/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 get time log analytics: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{
  "data": [
    {
      "group": {
        "customer": "5bae34dca878b5497748",
        "customerName": "Kund AB",
        "year": 2024,
        "month": 2
      },
      "hours": 124.5,
      "revenue": 99600
    },
    {
      "group": {
        "customer": "5bae34dca878b5497749",
        "customerName": "Bygg AB",
        "year": 2024,
        "month": 1
      },
      "hours": 88,
      "revenue": 70400
    }
  ],
  "meta": {
    "groupBy": ["customer", "month"],
    "dateField": "timestamp",
    "groupCount": 2,
    "limit": 20,
    "currentPage": 1,
    "hasMore": false,
    "nextPage": null
  }
}

This endpoint returns aggregated time logs.

HTTP Request

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

POST Parameters

These parameters are the same for all analytics endpoints.

Parameter Type Required? Description
fromDate String Yes Start of the date range, in the format 'YYYY-MM-DD'
toDate String Yes End of the date range (inclusive), in the format 'YYYY-MM-DD'. The date range can be at most 5 years
groupBy String or Array Yes What to group by. Either a single value, e.g. "customer", or an array of up to two different values, e.g. ["customer", "month"]
metrics Array Yes The metrics to calculate for each group, e.g. ["hours", "revenue"]
dateField String No The date field that fromDate/toDate and the date groupings (day, week, month, year) are based on. Defaults to the first value listed for each endpoint
filters Object No Filters that limit which objects are included. See each endpoint for available filters
sort Object No metric: one of the requested metrics, defaults to the first one. direction: "asc" or "desc", defaults to "desc"
limit Number No Number of groups per page. Default 20, maximum 500
page Number No Page number. Default 1

Response

Each object in data contains group, which describes the group, and one field per requested metric. group contains the ids and names for the requested groupings:

groupBy Fields in group
day date ('YYYY-MM-DD')
week year, week (ISO week)
month year, month
year year
status status (status code)

Other groupings return the id of the object together with its name, e.g. customer and customerName.

Use meta.hasMore and meta.nextPage to fetch the next page.

Invalid parameters, e.g. an unknown metric or grouping, a missing date range or an invalid id in filters, return HTTP status 400 with an errorMessage describing the error.

Time logs

Option Values
dateField timestamp, createDate
groupBy customer, project, user, activity (time category), day, week, month, year
metrics hours, billableHours, nonBillableHours, cost, revenue, logCount
Filter Description
customerId Id of a customer
projectId Id of a project
userId Id of a user
activityId Id of a time category

Get Invoice Analytics

curl -X POST "https://app.seventime.se/api/2/analytics/invoices" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"fromDate":"2024-01-01","toDate":"2024-12-31","groupBy":"month","metrics":["netAmount","invoiceCount"]}'

This endpoint returns aggregated invoices. See Get Time Log Analytics for the request and response format.

Draft, obliterated and customer loss invoices (status 1, 4 and 7) are excluded unless filters.status is specified. Credit invoices are subtracted from the amounts.

HTTP Request

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

Option Values
dateField invoiceDate, sentDate, createDate
groupBy customer, project, month, year, status
metrics netAmount (excl. tax), grossAmount (incl. tax), taxAmount, invoiceCount
Filter Description
customerId Id of a customer
projectId Id of a project
status Invoice status, 1-7. Only invoices with this status are included

Get Expense Analytics

curl -X POST "https://app.seventime.se/api/2/analytics/expenses" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"fromDate":"2024-01-01","toDate":"2024-12-31","groupBy":"expenseItem","metrics":["quantity","revenue"]}'

This endpoint returns aggregated expenses. See Get Time Log Analytics for the request and response format.

HTTP Request

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

Option Values
dateField timestamp, createDate
groupBy customer, project, user, expenseItem, day, week, month, year
metrics cost, revenue, quantity, expenseCount
Filter Description
customerId Id of a customer
projectId Id of a project
userId Id of a user
expenseItemId Id of an expense item

Get Machine Time Log Analytics

curl -X POST "https://app.seventime.se/api/2/analytics/machineTimeLogs" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"fromDate":"2024-01-01","toDate":"2024-12-31","groupBy":["machine","month"],"metrics":["hours"]}'

This endpoint returns aggregated machine time logs. See Get Time Log Analytics for the request and response format.

HTTP Request

POST https://app.seventime.se/api/2/analytics/machineTimeLogs

Option Values
dateField timestamp, createDate
groupBy machine, customer, project, user, day, week, month, year
metrics hours, billableHours, nonBillableHours, cost, revenue, logCount
Filter Description
customerId Id of a customer
projectId Id of a project
userId Id of a user
machineId Id of a machine

Get Driver Journal Analytics

curl -X POST "https://app.seventime.se/api/2/analytics/driverJournals" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"fromDate":"2024-01-01","toDate":"2024-12-31","groupBy":"vehicle","metrics":["distance","tripCount"]}'

This endpoint returns aggregated driver journals. See Get Time Log Analytics for the request and response format.

HTTP Request

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

Option Values
dateField timestamp, createDate
groupBy user, customer, project, vehicle, day, week, month, year
metrics distance, cost, revenue, tripCount
Filter Description
customerId Id of a customer
projectId Id of a project
userId Id of a user
vehicleId Id of a vehicle

Get Supplier Invoice Analytics

curl -X POST "https://app.seventime.se/api/2/analytics/supplierInvoices" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"fromDate":"2024-01-01","toDate":"2024-12-31","groupBy":"distributor","metrics":["netAmount"]}'

This endpoint returns aggregated supplier invoices. See Get Time Log Analytics for the request and response format.

Obliterated supplier invoices (status 35) are excluded unless filters.status is specified. Credit invoices are subtracted from the amounts.

HTTP Request

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

Option Values
dateField invoiceDate, dueDate, createDate
groupBy customer, project, distributor, month, year, status
metrics netAmount (excl. tax), grossAmount (incl. tax), taxAmount, invoiceCount
Filter Description
customerId Id of a customer
projectId Id of a project
distributorId Id of a distributor
status Supplier invoice status: 1 (Registered), 5 (Draft), 7 (Sent), 10 (Invoiced), 15 (Attest pending), 35 (Obliterated) or 50 (Paused)

Get Work Order Analytics

curl -X POST "https://app.seventime.se/api/2/analytics/workOrders" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"fromDate":"2024-01-01","toDate":"2024-12-31","groupBy":["workOrderType","month"],"metrics":["workOrderCount"]}'

This endpoint returns the number of work orders. See Get Time Log Analytics for the request and response format.

HTTP Request

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

Option Values
dateField createDate, startDate
groupBy customer, project, department, workOrderType, status, month, year
metrics workOrderCount
Filter Description
customerId Id of a customer
projectId Id of a project
departmentId Id of a department
workOrderTypeId Id of a work order type
status Work order status code

Get Purchase Order Analytics

curl -X POST "https://app.seventime.se/api/2/analytics/purchaseOrders" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"fromDate":"2024-01-01","toDate":"2024-12-31","groupBy":"distributor","metrics":["netAmount","orderCount"]}'

This endpoint returns aggregated purchase orders. See Get Time Log Analytics for the request and response format.

Draft and obliterated purchase orders (status 1 and 3) are excluded unless filters.status is specified.

HTTP Request

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

Option Values
dateField purchaseOrderDate, createDate
groupBy distributor, project, status, month, year
metrics netAmount (excl. tax), grossAmount (incl. tax), cost, orderCount
Filter Description
distributorId Id of a distributor
projectId Id of a project
status Purchase order status: 1 (Draft), 2 (Sent), 3 (Obliterated), 4 (Confirmed) or 10 (Delivered)

Get Quote Analytics

curl -X POST "https://app.seventime.se/api/2/analytics/quotes" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"fromDate":"2024-01-01","toDate":"2024-12-31","groupBy":["month","status"],"metrics":["quoteCount","quotedAmount"]}'

This endpoint returns aggregated quotes. See Get Time Log Analytics for the request and response format.

Draft quotes (status 1) are excluded unless filters.status is specified. To calculate e.g. a win rate, group by ["month", "status"] and compare quoteCount per status.

HTTP Request

POST https://app.seventime.se/api/2/analytics/quotes

Option Values
dateField quoteDate, sentDate, createDate
groupBy customer, project, quoteCategory, status, month, year
metrics quotedAmount (excl. tax), quotedAmountInclTax, quoteCount
Filter Description
customerId Id of a customer
projectId Id of a project
quoteCategoryId Id of a quote category
status Quote status: 1 (Draft), 2 (Sent), 3 (Accepted), 4 (Not accepted) or 10 (Opportunity)

Get Task Analytics

curl -X POST "https://app.seventime.se/api/2/analytics/tasks" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"fromDate":"2024-01-01","toDate":"2024-12-31","groupBy":["user","completed"],"metrics":["taskCount"]}'

This endpoint returns the number of tasks. See Get Time Log Analytics for the request and response format.

HTTP Request

POST https://app.seventime.se/api/2/analytics/tasks

Option Values
dateField createDate, dueDate, startDate, completedDate
groupBy user, customer, project, completed, month, year
metrics taskCount
Filter Description
customerId Id of a customer
projectId Id of a project
userId Id of a user

Get Project Analytics

curl -X POST "https://app.seventime.se/api/2/analytics/projects" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"fromDate":"2024-01-01","toDate":"2024-12-31","groupBy":"projectType","metrics":["projectCount"]}'

This endpoint returns the number of projects. See Get Time Log Analytics for the request and response format.

HTTP Request

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

Option Values
dateField createdDate, startDate, endDate, completedDate
groupBy customer, projectType, department, resultUnit, status, invoiceStatus, month, year
metrics projectCount
Filter Description
customerId Id of a customer
projectTypeId Id of a project type
departmentId Id of a department
resultUnitId Id of a result unit
status Project status code
invoiceStatus Invoice status: 0 (None), 5 (Not billable), 10 (Ready to be invoiced), 20 (Partly invoiced) or 30 (Fully invoiced)

Company Information

Get Company Information

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

let url = "https://app.seventime.se/api/2/companyInformation/";
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": "5171464ffbb708f33e000001",
    "companyName": "Company AB",
    "address": "Street 1",
    "zipCode": "111 22",
    "city": "Stockholm",
    "organizationNumber": "556677-8899"
  }
}

This endpoint retrieves information about the company connected to the API key.

HTTP Request

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

URL Parameters

No parameters

If no company information is found for the account, HTTP 500 is returned with the errorMessage "Could not find company information".

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
name The name of the contact persons
sortBy name If specified, a sort will be made on the specified parameter
sortDirection ascending "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending
limit 100 Number of contact persons per page. Maximum 500
page 1 Page number

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:

{
  "_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. Note that the contact person is returned directly, not wrapped in a data object.

HTTP Request

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

URL Parameters

Parameter Description
_id The _id of the contact person to retrieve

Create a Contact Person

curl -X POST "https://app.seventime.se/api/2/contactPersons/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"customer":"5f48eb712ebe7ebe6eb37b","name":"Anna Andersson","title":"Chef","workPhone":"","cellPhone":"","email":"email@company.com","isActive":"true","mainContact":"false"}'
let jsonData = {
  customer: '5f48eb712ebe7ebe6eb37b',
  name: 'Anna Andersson',
  title: 'Utvecklare',
  workPhone: '',
  cellPhone: '',
  email: 'email@company.com',
  isActive: true,
  mainContact: false
};

let options = {
  url: 'https://app.seventime.se/api/2/contactPersons',
  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 contact person: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{
  "_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 creates a contact person.

HTTP Request

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

POST Parameters

Parameter Type Required? Description
customer String Yes Id of the customer that the contact person will belong to
name String Yes Name of the contact person
title String No Title
workPhone String No Work phone
cellPhone String No Cell phone
email String No Email
isActive Boolean No Is the contact person active? Default true
mainContact Boolean No Main contact. Default false

Update a Contact person

curl -X PUT "https://app.seventime.se/api/2/contactPersons/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"571f61330c7f498a4712448b","isActive":"false"}' 
let jsonData = {
  _id: '571f61330c7f498a4712448b',
  isActive: false
};

let options = {
  url: 'https://app.seventime.se/api/2/contactPersons',
  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("Contact person updated: " + body.name + ", _id: " + body._id);

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

The above command returns JSON structured like this:

{
  "_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"
}
"Contact person updated: Anna, _id: 5fb7bcd0ab7bb01d4d54832"

This endpoint updates a contact person.

HTTP Request

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

PUT Parameters

The table below shows the required fields. Other available fields can be found in the section 'Create a Contact Person'. Empty values for name, title, workPhone, cellPhone and email are ignored, so these fields cannot be cleared through the API.

Parameter Type Required? Description
_id String Yes Id of the contact person

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.
email 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
limit 100 Number of customers per page. Maximum 500
page 1 Page number

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 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.
typeOfCustomer Number No Type of customer. 10 for company, 20 for private. If not specified or invalid, this will be set to 10
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 customer. If not specified, this will be set to 30
notes String No Notes
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. Ignored when creating a customer, can only be set when updating
defaultEmailSubject String No Default email subject for invoices. Ignored when creating a customer, can only be set when updating
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
personalNumber String No Personal number
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

Custom Fields

Get Custom fields

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

let url = "https://app.seventime.se/api/2/customFields/?entityType=200";
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": "572cc7advab059725982b",
      "selectFieldData": [],
      "fieldType": 100,
      "fieldName": "Kund",
      "include": true,
      "required": false
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves custom fields.

HTTP Request

GET https://app.seventime.se/api/2/customFields/?entityType=<entityType>

Query Parameters

Parameter Default Description
entityType 100 Number corresponding to entity type. See table below for available types.

If entityType is not one of the codes in the table below, HTTP 400 is returned with the errorMessage "Invalid entity type". If no field configuration exists for the entity type, HTTP 404 is returned.

The response contains all fields in the field configuration for the entity type (both standard fields and custom fields). Custom fields have fieldType 10100 (Text), 10200 (Yes/No), 10300 (Date), 10400 (Numeric), 10500 (Select list) or 10600 (Multi select list).

Entity types

Code Description
100 Time log
200 Work order
300 Tasks
400 Invoice
500 Project
600 Expense
700 Machine time log
800 Driver journal
900 Salary deviation
1000 User
1100 Customer
1200 Absence
1300 Work time absence
1400 Quote
1500 Machine
1600 Object item
1700 Customer signature
1800 Supplement order
1900 Construction diary
2000 Checklist
2100 Payment plan

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/?sortBy=departmentNumber&sortDirection=descending

Parameter Default Description
sortBy name If specified, a sort will be made on the specified parameter
sortDirection ascending "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending
limit 100 Number of departments per page. Maximum 500
page 1 Page number

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
limit 100 Number of distributors per page. Maximum 500
page 1 Page number

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 (24 characters). This field must be included, otherwise HTTP status 400 is returned
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 create 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. Must be unique (case insensitive), otherwise an error will be returned
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
phone String No Phone number of the distributor
webAddress String No Web address of the distributor
email String 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
IBAN String No IBAN for distributor
BIC String No BIC 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 Object No Object 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 Number No Invoice deduction
deductionExpenseItem String No Id of the expense item used for the deduction
invoiceNumberSeries String No Invoice number series
invoiceCounter Number 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 update 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 Distributor'.

Parameter Type Required? Description
_id String Yes Id of the distributor
name String Yes Name of the distributor. Must not be used by another distributor (case insensitive)

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.

Documents can also be fetched directly from the Documents API. A document belongs to either:

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
      }
    ]
  }
}
curl "https://app.seventime.se/api/2/documents?entityId=5bae34dca878b5497748&entityType=200" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/documents?entityId=5bae34dca878b5497748&entityType=200";
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": [
    {
      "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/...",
      "realPath": "1234/workOrders/5bae34dca878b5497748/20210824134016/plan1.pdf",
      "contentType": "application/pdf",
      "size": 20548,
      "user": "571f61330c7f498a2d5812",
      "userName": "Anna Andersson",
      "isLink": false,
      "isFolder": false,
      "folderId": null,
      "isPublic": false
    }
  ]
}

This endpoint retrieves documents for an entity or for a document list.

HTTP Request

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

Query Parameters

Parameter Required? Description
entityId Yes* Id of the parent object, e.g. id of a work order.
entityType Yes* Entity type of the parent. See table below for available types and corresponding code.
documentListId Yes* Id of the document list. Used for documents in the general document archive.
folderId No Folder id. Only used together with documentListId. Defaults to null, which returns documents and folders in the root of the document list.

*Either entityId + entityType or documentListId is required. They cannot be combined.

Get a specific Document

curl "https://app.seventime.se/api/2/documents/6124daa00c1532914b92?entityId=5bae34dca878b5497748&entityType=200" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/documents/6124daa00c1532914b92?entityId=5bae34dca878b5497748&entityType=200";
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": {
    "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/...",
    "realPath": "1234/workOrders/5bae34dca878b5497748/20210824134016/plan1.pdf",
    "contentType": "application/pdf",
    "size": 20548,
    "user": "571f61330c7f498a2d5812",
    "userName": "Anna Andersson",
    "isLink": false,
    "isFolder": false,
    "folderId": null,
    "isPublic": false
  }
}

This endpoint retrieves a specific document. For documents attached to an entity, include entityId and entityType as query parameters. For documents in a document list, only the document id is required.

HTTP Request

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

URL Parameters

Parameter Description
_id The _id of the document to retrieve

Query Parameters

Parameter Required? Description
entityId Yes* Id of the parent object for documents attached to an entity.
entityType Yes* Entity type of the parent for documents attached to an entity.

*Required only when the document is attached to an entity.

Get Document Lists

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

let url = "https://app.seventime.se/api/2/documentLists";
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": "64f1daa00c1532914b92",
      "title": "Project files",
      "createdByUser": "571f61330c7f498a2d5812",
      "createDate": "2021-08-24T11:40:16.285Z",
      "modifiedByUser": "571f61330c7f498a2d5812",
      "modifiedDate": "2021-08-24T11:40:16.285Z",
      "archived": false
    }
  ]
}

This endpoint retrieves document lists. Use the returned _id as documentListId when listing or uploading documents in the general document archive.

HTTP Request

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

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":"base64-encoded-file-content","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,
  "data": {
    "createDate": "2021-08-24T11:40:16.285Z",
    "modifiedDate": "2021-08-24T11:40:16.285Z",
    "_id": "6124daa00c1532914b92",
    "name": "plan2.pdf",
    "path": "https://seventimedev.s3-eu-west-1.amazonaws.com/...",
    "realPath": "1234/workOrders/5bae34dca878b5497748/20210824134016/plan2.pdf",
    "contentType": "application/pdf",
    "size": 20548,
    "user": "571f61330c7f498a2d5812",
    "userName": "Anna Andersson",
    "isLink": false,
    "isFolder": false,
    "folderId": null,
    "isPublic": false
  }
}

This endpoint uploads a document or adds a folder. Uploads are supported in two modes:

To create a folder, send isFolder: true. Folder uploads do not require fileContent or contentType, but file.options.fileName is still required due to the current implementation.

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.
documentListId String Yes* Id of the document list. Used instead of entityId + entityType for the general document archive.
file Object Yes Object containing the file and information about the file. See below for more details
folderId String No Folder id in which the document will be placed. Defaults to null when omitted.
isFolder Boolean No Set to true to create a folder instead of uploading a file.

*Either entityId + entityType or documentListId is required. They cannot be combined. entityId + entityType are not required for folders when using documentListId.

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 must contain fileName and contentType. Folder uploads currently still require file.options.fileName due to the current implementation.
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

Update a document

curl -X PUT "https://app.seventime.se/api/2/documents/6124daa00c1532914b92?entityId=5bae34dca878b5497748&entityType=200" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"name":"updated-plan.pdf","folderId":null,"isPublic":true}'
let jsonData = {
  name: 'updated-plan.pdf',
  folderId: null,
  isPublic: true
};

let options = {
  url: 'https://app.seventime.se/api/2/documents/6124daa00c1532914b92?entityId=5bae34dca878b5497748&entityType=200',
  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('File updated');
  } else {
    console.error("ERROR! Unable to update document: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{
  "success": true,
  "data": {
    "createDate": "2021-08-24T11:40:16.285Z",
    "modifiedDate": "2021-08-25T09:20:40.126Z",
    "_id": "6124daa00c1532914b92",
    "name": "updated-plan.pdf",
    "path": "https://seventimedev.s3-eu-west-1.amazonaws.com/...",
    "realPath": "1234/workOrders/5bae34dca878b5497748/20210824134016/plan2.pdf",
    "contentType": "application/pdf",
    "size": 20548,
    "user": "571f61330c7f498a2d5812",
    "userName": "Anna Andersson",
    "isLink": false,
    "isFolder": false,
    "folderId": null,
    "isPublic": true
  }
}

This endpoint updates a document or folder. It can rename the document, move it to another folder, or update the public flag. For documents attached to an entity, include entityId and entityType as query parameters or in the request body. For documents in a document list, only the document id is required.

HTTP Request

PUT https://app.seventime.se/api/2/documents/<_id>

URL Parameters

Parameter Description
_id The _id of the document to update

Query Parameters

Parameter Required? Description
entityId Yes* Id of the parent object for documents attached to an entity.
entityType Yes* Entity type of the parent for documents attached to an entity.

*Required only when the document is attached to an entity. These values can also be sent in the body.

PUT Parameters

Parameter Type Required? Description
name String No New document or folder name. Cannot be empty.
folderId String No Folder id to move the document into. Send null, "null", or an empty string to move it to the root. A folder cannot be moved into itself.
isPublic Boolean No Public flag for the document.
entityId String No* Id of the parent object for documents attached to an entity.
entityType Number No* Entity type of the parent for documents attached to an entity.

*Required only when the document is attached to an entity and not sent as query parameters.

Delete a document

curl -X DELETE "https://app.seventime.se/api/2/documents/6124daa00c1532914b92?entityId=5bae34dca878b5497748&entityType=200" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json"
let options = {
  url: 'https://app.seventime.se/api/2/documents/6124daa00c1532914b92?entityId=5bae34dca878b5497748&entityType=200',
  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('File deleted');
  } else {
    console.error("ERROR! Unable to delete document: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{
  "success": true
}

This endpoint deletes a document or folder. For documents attached to an entity, include entityId and entityType as query parameters. For documents in a document list, only the document id is required. Deleting a file document also removes the stored file.

HTTP Request

DELETE https://app.seventime.se/api/2/documents/<_id>

URL Parameters

Parameter Description
_id The _id of the document to delete

Query Parameters

Parameter Required? Description
entityId Yes* Id of the parent object for documents attached to an entity.
entityType Yes* Entity type of the parent for documents attached to an entity.

*Required only when the document is attached to an entity.

Driver Journals

Get Driver Journals

curl "https://app.seventime.se/api/2/driverJournals/?fromDate=2016-06-01&toDate=2016-06-30&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/?fromDate=2016-06-01&toDate=2016-06-30&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,
    "totalResourcesIsExact": true,
    "totalPages": 18,
    "currentPage": 2,
    "hasMore": true,
    "nextPage": 3
  },
  "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.

At least one filter, e.g. a date range or a user, has to be specified. A request without any filter returns HTTP status 422 with the code QUERY_TOO_BROAD.

The result is paginated. meta.totalResources is capped at 2000; if there are more matching driver journals, meta.totalResourcesIsExact is false and meta.totalPages is null. Use meta.hasMore and meta.nextPage to fetch the next page.

HTTP Request

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

Query Parameters

Parameter Default Description
user If specified, driver journals for the user with this id will be included.
project If specified, driver journals for the project with this id will be included.
customer If specified, driver journals for the customer with this id will be included.
workOrder If specified, driver journals for the work order with this id 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.
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 timestamp If specified, a sort will be made on the specified parameter
sortDirection "ascending" or "descending". The sort order will be ascending or descending
limit 100 Number of driver journals per page. Maximum 500
page 1 Page number

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":"512031465648817e55b","user":"5f48eb3e65d7e5489134452","carRegistrationNumber":"ABC123","driverJournalItemType":"5e5ef4124135975","startAddress":"Address start, Stockholm","endAddress":"Address end, Stockholm","travelPurpose":"Delivery","startOdometer":45,"endOdometer":60}'
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);
    console.error(body);
  }
});

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? If not specified, this will be set to true
isSalaryCompensated Boolean No Is the driver jounal salary compensated? If not specified, this will be set to false

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",
  "name": ""
}
"Driver journal deleted: _id: 5fc619b962947312234894"

This endpoint deletes a driver journal. A driver journal that has been invoiced or salary processed cannot be deleted.

HTTP Request

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

DELETE Parameters

Parameter Type Required? Description
_id String Yes Id of the driver journal
deletedByUser String Yes Id of the user who deleted 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,
    "totalResourcesIsExact": true,
    "totalPages": 311,
    "currentPage": 1,
    "hasMore": true,
    "nextPage": 2
  },
  "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.

At least one filter, e.g. a date range or a user, has to be specified. A request without any filter returns HTTP status 422 with the code QUERY_TOO_BROAD.

The result is paginated. meta.totalResources is capped at 2000; if there are more matching expenses, meta.totalResourcesIsExact is false and meta.totalPages is null. Use meta.hasMore and meta.nextPage to fetch the next page.

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.
workOrder If specified, expenses for the work order with this id will be included.
user If specified, expenses registered for the user with this id 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-DD', 'YYYY-MM-DD HH:MM', 'YYYY-MM-DD HH:MM:SS', 'YYYY-MM-DDTHH:MM', 'YYYY-MM-DDTHH:MM:SS'
limit 100 Number of expenses per page. Maximum 500
page 1 Page number
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/expenseItems

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.
lastModified If specified, expense items that has been modified since the specified timestamp will be included. Accepted formats: 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM', 'YYYY-MM-DD HH:MM:SS', 'YYYY-MM-DDTHH:MM', 'YYYY-MM-DDTHH:MM:SS'
limit 100 Number of expense items per page. Maximum 500
page 1 Page number
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 Number No Number of items. If not specified, this will be set to 1
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
unitTaxPercent Number No* Tax percent on the unit price. If expenseItem is specified, the tax on the expense item will be used. *Required if expenseItem is not specified
timestamp String No Date of the expense in the format 'YYYY-MM-DD'. If not specified, the current date will be used
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",
  "name": "10-pack Reaktionsbollar"
}
"Expense deleted: _id: 5fbe6844166256479138667"

This endpoint deletes an expense. Expenses that have been invoiced, attested or salary processed cannot be deleted.

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,
    "totalResourcesIsExact": true,
    "totalPages": 663,
    "currentPage": 9,
    "hasMore": true,
    "nextPage": 10
  },
  "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.
customerName If specified, invoices where the customer name exactly matches 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 invoiceDate If specified, a sort will be made on the specified parameter
sortDirection ascending "ascending" or "descending". Applies to sortBy, or to invoiceDate if sortBy is not specified
limit 100 Number of results per page (1-500). See 'Pagination'
page 1 Page to retrieve. See 'Pagination'

An invalid date in any of the date parameters returns HTTP 400 with the errorMessage "Invalid fromDate" or "Invalid toDate".

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. The tags are sorted by tagName. If no invoice tags have been created for the account, an empty array ([]) is returned without the data wrapper.

HTTP Request

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

URL Parameters

No parameters

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: 2,
  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. The created invoice is returned directly (not wrapped in a data property).

Missing customer, createdByUser or language returns HTTP 400. Other validation errors (e.g. an id that is not found or an invalid value) are returned with HTTP 500 and a descriptive errorMessage.

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. Must be SV (Swedish) or EN (English)
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 customer's payment days, or + the default payment terms if the customer has no payment days
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
ourReference String 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. The work order must belong to the specified customer, and to the specified project if project is specified
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. Must be a number. If not specified, this will be set to 25.
currencyCode String No Currency code to be used on the invoice. Must be SEK or EUR
currencyRate Number No Currency rate between SEK and the selected currency. Only used if currencyCode is not SEK
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 item. *For itemType expense, one of expenseItem, articleNumber or name is required. If no expense item is found, the row is created as a free-text (general) row using articleNumber/name
articleNumber String No Article number. Used for expense rows without an expenseItem
name String No Name of the row. Used for expense and timelog rows. If not specified, the name of the expense item/time category is used
description String No Description of the row
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. 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. The updated invoice is returned directly (not wrapped in a data property). The fields createdByUser, createdByUserName and invoiceNumber are ignored. If invoiceItems is specified, it replaces all existing invoice items.

Missing _id or modifiedByUser returns HTTP 400. Other validation errors are returned with HTTP 500 and a descriptive errorMessage.

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 No Should it be possible to use different tax rates on invoice rows?
taxPercent Number No* Tax rate on invoice rows *Required if 'multipleTaxesOnRows' is false.
invoiceItems Array No Array containing the invoice items. Replaces the existing 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
machineName If specified, machines that match the parameter will be included.
machineNumber If specified, machines that match the parameter will be included.
machineTypeName If specified, machines that match the parameter will be included.
machineModel If specified, machines that match the parameter will be included.
serialNumber If specified, machines that match the parameter will be included.
serviceable "true" or "false". If specified, machines that match the parameter will be included.
sortBy machineName If specified, a sort will be made on the specified parameter
sortDirection ascending "ascending" or "descending". The sort order will be ascending or descending
limit 100 Number of machines per page. Maximum 500
page 1 Page number

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/machines/<_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/

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

Machine Time Logs

Get Machine Time Logs

curl "https://app.seventime.se/api/2/machineTimeLogs/?fromDate=2017-10-01&toDate=2017-10-31&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/?fromDate=2017-10-01&toDate=2017-10-31&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,
    "totalResourcesIsExact": true,
    "totalPages": 3,
    "currentPage": 1,
    "hasMore": true,
    "nextPage": 2
  },
  "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.

At least one filter, e.g. a date range or a user, has to be specified. A request without any filter returns HTTP status 422 with the code QUERY_TOO_BROAD.

The result is paginated. meta.totalResources is capped at 2000; if there are more matching machine time logs, meta.totalResourcesIsExact is false and meta.totalPages is null. Use meta.hasMore and meta.nextPage to fetch the next page.

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'
user If specified, machine time logs registered for the user with this id will be included
machineName If specified, machine time logs for the machine with this name will be included
customerName If specified, machine time logs for the customer with this name will be included
projectName If specified, machine time logs for the project with this name will be included
workOrderTitle If specified, machine time logs for the work order with this title will be included
workOrderNumber If specified, machine time logs for the work order with this number will be included
departmentName If specified, machine time logs for the department with this name will be included
limit 100 Number of machine time logs per page. Maximum 500
page 1 Page number
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/machineTimeLogs/5a4bc02e40a13d77915827619" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-type: application/json"
/* Sample with the request library */

let url = "https://app.seventime.se/api/2/machineTimeLogs/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/machineTimeLogs/<_id>

URL Parameters

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

Create a Machine Time Log

curl -X POST "https://app.seventime.se/api/2/machineTimeLogs/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"createdByUser":"51203146506d97461389557821","user":"51203146506d97461389557821","machine":"59e75917ae561db7364829167","time":2,"timestamp":"2024-01-15T08:00:00.000Z","description":"Excavation"}'
let jsonData = {
  createdByUser: '51203146506d97461389557821',
  user: '51203146506d97461389557821',
  machine: '59e75917ae561db7364829167',
  time: 2,
  timestamp: '2024-01-15T08:00:00.000Z',
  description: 'Excavation'
};

let options = {
  url: 'https://app.seventime.se/api/2/machineTimeLogs',
  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 machine time log: " + error);
    console.error(body);
  }
});

The above command returns the created machine time log, structured like this:

{
  "_id": "65a50f80d1e44854f9c12345",
  "time": 2,
  "description": "Excavation",
  "internalDescription": "",
  "machine": "59e75917ae561db7364829167",
  "machineName": "Grävare",
  "user": "51203146506d97461389557821",
  "userName": "Anna Andersson",
  "pricePerHour": 850,
  "price": 1700,
  "cost": 0,
  "isInvoiced": false,
  "isInvoiceable": true,
  "timestamp": "2024-01-15T08:00:00.000Z"
}

This endpoint creates a machine time log.

The price of a machine time log is always calculated from the price per hour of the machine. The fields price and pricePerHour cannot be set via the API; sending either of them results in an error.

The time can be given either with time, or with timestamp and endTimestamp, in which case the time is calculated from the difference between them. If timestamp is omitted the current date and time is used.

HTTP Request

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

POST Parameters

Parameter Type Required? Description
createdByUser String Yes Id of the user creating the machine time log
machine String Yes Id of the machine
user String No Id of the user the machine time log is registered for
time Number Yes* Registered time in hours. Must be a positive number
timestamp String No Start date and time in ISO 8601 format. Defaults to the current date and time
endTimestamp String No* End date and time in ISO 8601 format. Cannot be before timestamp
customer String No Id of the customer
project String No Id of the project
workOrder String No Id of the work order
department String No Id of the department
resultUnit String No Id of the result unit
costAccount String No Id of the cost account
description String No Description
internalDescription String No Internal description
isInvoiceable Boolean No If the machine time log is invoiceable
supplementOrder Boolean No If the machine time log is a supplement order
supplementOrderTime Number No Supplement order time in hours. Only used when supplementOrder is true

*time is required unless endTimestamp is given.

Update a Machine Time Log

curl -X PUT "https://app.seventime.se/api/2/machineTimeLogs/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"65a50f80d1e44854f9c12345","modifiedByUser":"51203146506d97461389557821","time":3}'
let jsonData = {
  _id: '65a50f80d1e44854f9c12345',
  modifiedByUser: '51203146506d97461389557821',
  time: 3
};

let options = {
  url: 'https://app.seventime.se/api/2/machineTimeLogs',
  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);
  } else {
    console.error("ERROR! Unable to update machine time log: " + error);
    console.error(body);
  }
});

The above command returns the updated machine time log, structured like this:

{
  "_id": "65a50f80d1e44854f9c12345",
  "time": 3,
  "description": "Excavation",
  "internalDescription": "",
  "machine": "59e75917ae561db7364829167",
  "machineName": "Grävare",
  "user": "51203146506d97461389557821",
  "userName": "Anna Andersson",
  "pricePerHour": 850,
  "price": 2550,
  "cost": 0,
  "isInvoiced": false,
  "isInvoiceable": true,
  "timestamp": "2024-01-15T08:00:00.000Z",
  "modifiedDate": "2024-01-16T10:12:00.000Z"
}

This endpoint updates a machine time log. Only the fields included in the request are updated. The price is recalculated from the machine's price per hour.

A machine time log that has been invoiced cannot be updated. The fields isInvoiced, invoicedDate and invoice are ignored.

HTTP Request

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

PUT Parameters

Parameter Type Required? Description
_id String Yes Id of the machine time log
modifiedByUser String Yes Id of the user updating the machine time log
machine String No Id of the machine
user String No Id of the user the machine time log is registered for
time Number No Registered time in hours. Must be a positive number
timestamp String No Start date and time in ISO 8601 format
endTimestamp String No End date and time in ISO 8601 format. Cannot be before timestamp
customer String No Id of the customer
project String No Id of the project
workOrder String No Id of the work order
department String No Id of the department
resultUnit String No Id of the result unit
costAccount String No Id of the cost account
description String No Description
internalDescription String No Internal description
isInvoiceable Boolean No If the machine time log is invoiceable
supplementOrder Boolean No If the machine time log is a supplement order

Delete a Machine Time Log

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

let options = {
  url: 'https://app.seventime.se/api/2/machineTimeLogs',
  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);
  } else {
    console.error("ERROR! Unable to delete machine time log: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{
  "_id": "65a50f80d1e44854f9c12345"
}

This endpoint deletes a machine time log. A machine time log that has been invoiced cannot be deleted.

HTTP Request

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

DELETE Parameters

Parameter Type Required? Description
_id String Yes Id of the machine time log
deletedByUser String Yes Id of the user who deleted the machine time log

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 name If specified, a sort will be made on the specified parameter
sortDirection ascending "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending
limit 100 Number of price lists per page. Maximum 500
page 1 Page number

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 whose name exactly matches the parameter will be included.
projectNumber If specified, projects that match the parameter will be included.
customer If specified, projects that belong to the customer with this id will be included.
lastModified If specified, projects that has been modified since the specified timestamp will be included. Accepted formats: 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM', 'YYYY-MM-DD HH:MM:SS', 'YYYY-MM-DDTHH:MM', 'YYYY-MM-DDTHH:MM:SS'. An invalid value returns HTTP 400
sortBy name If specified, a sort will be made on the specified parameter
sortDirection ascending "ascending" or "descending". Only used if sortBy is specified
limit 100 Number of results per page (1-500). See 'Pagination'
page 1 Page to retrieve. See 'Pagination'

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",
      "plannedStatus": false,
      "inProgressStatus": false,
      "closedStatus": true,
      "isActive": true
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves project statuses, in the order they are configured.

HTTP Request

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

URL Parameters

No parameters

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, sorted by projectTypeName.

HTTP Request

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

URL Parameters

No parameters

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, sorted by tagName. If no project tags have been created for the account, an empty array ([]) is returned without the data wrapper.

HTTP Request

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

URL Parameters

No parameters

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. The created project is returned directly (not wrapped in a data property).

Missing name or createdByUser, an invalid billingMethod, a missing field required by the billing method, or a project number that is already in use returns HTTP 400. Other validation errors (e.g. an id that is not found) are returned with HTTP 500 and a descriptive errorMessage.

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 String 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
invoiceStatus Number No Invoice status of the project. Must be 5, 10, 20 or 30. 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. Must be after startDate if startDate is specified
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. Must be a non-zero number
fixedPrice Number No* Required if billingMethod is set to FIXED_PRICE. Must be a non-zero number
timeCategoryPriceList String No* Id of a price list. 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

PUT Parameters

The fields are sent as JSON in the request body. The table below shows the required fields. Other available fields can be found in the section 'Create a Project'. The updated project is returned directly (not wrapped in a data property).

Missing _id or modifiedByUser, an invalid billingMethod or a missing field required by the billing method returns HTTP 400. Other validation errors, e.g. a project number that is already used by another project, are returned with HTTP 500 and a descriptive errorMessage.

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,
    "totalResourcesIsExact": true,
    "totalPages": 35,
    "currentPage": 1,
    "hasMore": true,
    "nextPage": 2
  },
  "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.

At least one filter, e.g. a distributor or a project, has to be specified. A request without any filter returns HTTP status 422 with the code QUERY_TOO_BROAD.

The result is paginated. meta.totalResources is capped at 2000; if there are more matching purchase orders, meta.totalResourcesIsExact is false and meta.totalPages is null. Use meta.hasMore and meta.nextPage to fetch the next page.

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.
limit 100 Number of purchase orders per page. Maximum 500
page 1 Page number
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, 'SV' for Swedish or 'EN' for English
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 Number No Purchase order status. See below for available statuses. If not specified, this will be set to 1 (Draft)
ourReference String No Id of the user who is our reference. If not specified, this will be set to createdByUser
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 Name 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. Only for deliveryAddress
email String No Email address. Only for invoiceAddress

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 item. *If itemType is expense, one of expenseItem, articleNumber or name is required
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.name +  ", _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",
  "number": "1051",
  "name": "purchase Order 123"
}
"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
deletedByUser String Yes Id of the user who deleted 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, quotes 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, quotes 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, quotes 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, quotes with valid to date before or on this date will be included. The date has to be in the format 'YYYY-MM-DD'
limit 100 Number of quotes per page. Maximum 500
page 1 Page number
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 name If specified, a sort will be made on the specified parameter
sortDirection ascending "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

Statuses

Get Statuses

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

let url = "https://app.seventime.se/api/2/statuses/?entityType=200";
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:

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

This endpoint retrieves the statuses configured for an entity type. Note that the response is a plain JSON array and is not wrapped in a data property.

HTTP Request

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

Query Parameters

Parameter Default Description
entityType Required. Number corresponding to the entity type to retrieve statuses for, e.g. 200 for work orders or 500 for projects. If omitted, HTTP 400 is returned with the errorMessage "Entity type required".

The statuses are returned in the order they are configured. Sorting parameters are not supported.

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 Required. Id of the project that supplement orders will be retrieved from. The list endpoint requires this query parameter.
sortBy createDate If specified, a sort will be made on the specified parameter
sortDirection ascending "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending
limit 100 Number of supplement orders per page. Maximum 500
page 1 Page number

A request without project returns HTTP status 400 with {"errorMessage": "Field 'project' required"}.

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/supplementOrders/<_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 with this status will be included. Accepted values: 1, 5, 7, 10, 15, 35, 50. Other values are ignored
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.
attestFlag "ONLY_ATTESTED" or "ONLY_NON_ATTESTED". If specified, only attested or only non-attested supplier invoices will be included
obliterateFlag "ONLY_OBLITERATED" or "ONLY_NON_OBLITERATED". If specified, only obliterated (status 35) or only non-obliterated supplier invoices will be included. Overrides supplierInvoiceStatus
lastModified If specified, supplier invoices 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
limit 100 Number of supplier invoices per page. Maximum 500
page 1 Page number

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 String No Number of the supplier invoice
createdByUser String No Id of the user who created the supplier invoice
distributor String No Id of the distributor
distributorNumber String No Distributor number. Used to find the distributor if distributor is not specified
distributorName String No Distributor name. Used to find the distributor if neither distributor nor distributorNumber is specified
totalAmountInclTax Number No Total amount incl. tax on the supplier invoice. If not specified, this will be set to 0
totalTaxAmount Number No Total tax amount. If not specified, it is calculated from totalAmountInclTax and taxPercent
customer String No Id of the customer
project String No Id of the project
projectNumber String No Project number. Used to find the project if project is not specified
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
resultUnitCode String No Code of the result unit. Used if resultUnit is not specified
supplierInvoiceStatus Number No Status of the supplier invoice. 1 for 'Registered', 5 for 'Draft', 7 for 'Sent' and 10 for 'Invoiced'. If not specified, this will be set to 1
taxPercent Number No Tax on the supplier invoice as a percentage. Ex: 25 for 25% tax. If not specified, this will be set to 25
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'. If not specified, today's date will be used
dueDate String No Due date in the format 'YYYY-MM-DD'. If not specified, today's date will be used
exportedToEconomy Boolean No Is the supplier invoice exported to a economy system?
OCR String 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 item. *If itemType is expense, one of expenseItem, articleNumber or name is required
articleNumber String No Article number. Used for expense rows without expenseItem
name String No Name of the item. Used for expense rows without expenseItem
description String No Description of the item
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 item type. *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 of the item as a percentage. If not specified, this will be set to 25

Item types

This table contains the different item types used in the field invoiceItems.itemType. The values are case sensitive.

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 PUT "https://app.seventime.se/api/2/supplierInvoices/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"5fd0619c739154975825","modifiedByUser":"5f48eb3e65d7ee4942c6859741","notes":"Updated notes"}' 
let jsonData = {
  _id: "5fd0619c739154975825",
  modifiedByUser: '5f48eb3e65d7ee4942c6859741',
  notes: 'Updated notes'
};

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": 1,
  "notes": "Updated notes",
  "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 a Supplier Invoice'.

The fields supplierInvoiceStatus, exportedToEconomy, economySystemRef, attestStatus, attestedDate, supplierInvoiceLogEntries, documents, createdByUser and systemAccount are ignored when updating a supplier 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 deleted: _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. A supplier invoice that has been invoiced cannot be deleted.

HTTP Request

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

DELETE Parameters

Parameter Type Required? Description
_id String Yes Id of the Supplier Invoice
deletedByUser String Yes Id of the user who deleted the supplier invoice

Tasks

Get Tasks

curl "https://app.seventime.se/api/2/tasks/?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/tasks/?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": 280, 
    "totalPages": 94, 
    "currentPage": 1 },
  "data": [
    {
      "_id": "5dd0i31j238019132k328321k",
      "title": "API task",
      "tags": [],
      "dependsOn": [],
      "dependents": [],
      "reminders": [],
      "createDate": "2019-11-22T14:51:42.224Z",
      "createdByUser": "5112891383213mk0002",
      "__v": 0,
      "taskStatusRef": "5e8d2137213h312a2034d",
      "rank": "0|i000yv:"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves tasks.

HTTP Request

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

Query Parameters

Parameter Default Description
title If specified, tasks that match the parameter will be included.
fromStartDate If specified, tasks that start after this date will be included. The date has to be in the format 'YYYY-MM-DD'.
toStartDate If specified, tasks that start before this date will be included. The date has to be in the format 'YYYY-MM-DD'.
fromDueDate If specified, tasks that are due after this date will be included. The date has to be in the format 'YYYY-MM-DD'.
toDueDate If specified, tasks that are due before this date will be included. The date has to be in the format 'YYYY-MM-DD'.
user If specified, tasks that match the parameter will be included.
project If specified, tasks that match the parameter will be included.
customer If specified, tasks that match the parameter will be included.
quote If specified, tasks that match the parameter will be included.
workOrder If specified, tasks that match the parameter will be included.
invoice If specified, tasks that match the parameter will be included.
machine If specified, tasks that match the parameter will be included.
objectItem If specified, tasks that match the parameter will be included.
completed "true" or "false". If specified, only completed or only not completed tasks will be included.
sortBy title If specified, a sort will be made on the specified parameter
sortDirection ascending "ascending" or "descending". If specified and sortBy is specified the sort order will be ascending or descending
limit 100 Number of tasks per page. Maximum 500
page 1 Page number

A date parameter in an invalid format returns HTTP status 400 with {"errorMessage": "Incorrect date format", "field": "<parameter>"}.

Get a specific Task

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

let url = "https://app.seventime.se/api/2/tasks/5dd0i31j238019132k328321k";
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": "5dd0i31j238019132k328321k",
    "title": "API task",
    "tags": [],
    "dependsOn": [],
    "dependents": [],
    "reminders": [],
    "createDate": "2019-11-22T14:51:42.224Z",
    "createdByUser": "5112891383213mk0002",
    "__v": 0,
    "taskStatusRef": "5e8d2137213h312a2034d",
    "rank": "0|i000yv:"
  }
}

This endpoint retrieves a specific task.

HTTP Request

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

URL Parameters

Parameter Description
_id The _id of the task to retrieve

Create a task

curl -X POST "https://app.seventime.se/api/2/tasks/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"createdByUser":"5f48eb3e65d7ee4926574851","title":"API task"}'
let jsonData = {
  createdByUser: '5f48eb3e65d7ee4926574851',
  title: 'API task'
};

let options = {
  url: 'https://app.seventime.se/api/2/tasks',
  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 task: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{
  "tags": [],
  "dependsOn": [],
  "dependents": [],
  "_id": "6705973h3j1733m33j3382",
  "reminders": [],
  "todoItems": [],
  "documents": [],
  "notes": [],
  "createDate": "2024-10-08T11:01:36.674Z",
  "title": "API uppgift",
  "taskStatusRef": "5e8dea9332u23123ff34d",
  "rank": "0|i001pf:",
  "createdByUser": "5f48eb3e65d7ee4926574851",
  "project": null,
  "projectName": null,
  "workOrder": null,
  "workOrderTitle": null,
  "workOrderNumber": null
}

This endpoint creates a task

HTTP Request

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

POST Parameters

Parameter Type Required? Description
createdByUser String Yes Id of the user who created the task
title String Yes Title of the task
startDate String No Starting date for the task. This must be in the format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM'
dueDate String No Due date for the tasks. This must be in the format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM'
workOrder String No Id of the work order that the task will belong to. Cannot be combined with project
user String No Id of the user that will be assigned to the task
project String No Id of the project. Cannot be combined with workOrder
customer String No Id of the customer
quote String No Id of the quote
invoice String No Id of the invoice
machine String No Id of the machine
completed Boolean No Set if the task is completed or not

Update a Task

curl -X PUT "https://app.seventime.se/api/2/tasks/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"_id":"6705973h3j1733m33j3382","modifiedByUser":"5f48eb3e65d7ee4926574851","title":"Updated API task"}'
let jsonData = {
  _id: '6705973h3j1733m33j3382',
  modifiedByUser: '5f48eb3e65d7ee4926574851',
  title: 'Updated API task'
};

let options = {
  url: 'https://app.seventime.se/api/2/tasks',
  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("Task updated: _id: " + body._id);
  } else {
    console.error("ERROR! Unable to update task: " + error);
  }
});

The above command returns JSON structured like this:

{
  "tags": [],
  "dependsOn": [],
  "dependents": [],
  "_id": "6705973h3j1733m33j3382",
  "reminders": [],
  "todoItems": [],
  "documents": [],
  "notes": [],
  "createDate": "2024-10-08T11:01:36.674Z",
  "title": "Updated API task",
  "taskStatusRef": "5e8dea9332u23123ff34d",
  "rank": "0|i001pf:",
  "createdByUser": "5f48eb3e65d7ee4926574851",
  "project": null,
  "projectName": null,
  "workOrder": null,
  "workOrderTitle": null,
  "workOrderNumber": null
}
Task updated: _id: 6705973h3j1733m33j3382"

This endpoint updates a task

HTTP Request

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

PUT Parameters

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

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

Delete a Task

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

let options = {
  url: 'https://app.seventime.se/api/2/tasks',
  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("Task deleted: _id: " + body._id);
  } else {
    console.error("ERROR! Unable to delete task: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{ 
  "_id": "5f48eb3e65d7ee4926574851",
  "title": "Updated API task"
}
"Task deleted: _id: 5f48eb3e65d7ee4926574851"

This endpoint deletes a task

HTTP Request

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

DELETE Parameters

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

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,
    "totalResourcesIsExact": true,
    "totalPages": 394,
    "currentPage": 1,
    "hasMore": true,
    "nextPage": 2
  },
  "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.

The result is paginated. meta.totalResources is capped at 2000; if there are more matching time logs, meta.totalResourcesIsExact is false and meta.totalPages is null. Use meta.hasMore and meta.nextPage to fetch the next page.

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-DD', 'YYYY-MM-DD HH:MM', 'YYYY-MM-DD HH:MM:SS', 'YYYY-MM-DDTHH:MM', 'YYYY-MM-DDTHH:MM:SS'
endTimestamp If specified, time logs that end before the given date and time will be included. Accepted formats: 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM', 'YYYY-MM-DD HH:MM:SS', 'YYYY-MM-DDTHH:MM', 'YYYY-MM-DDTHH:MM:SS'
invoicedDate If specified, time logs invoiced on the specified date will be included. Accepted formats: 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM', 'YYYY-MM-DD HH:MM:SS', 'YYYY-MM-DDTHH:MM', 'YYYY-MM-DDTHH:MM:SS'
isAbsence If set to "true", only time logs that are 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-DD', 'YYYY-MM-DD HH:MM', 'YYYY-MM-DD HH:MM:SS', 'YYYY-MM-DDTHH:MM', 'YYYY-MM-DDTHH:MM:SS'
limit 100 Number of time logs per page. Maximum 500
page 1 Page number
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
limit 100 Maximum number of time categories to return. Maximum 500
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-DD', 'YYYY-MM-DD HH:MM', 'YYYY-MM-DD HH:MM:SS', 'YYYY-MM-DDTHH:MM', 'YYYY-MM-DDTHH:MM:SS'
endTimestamp String No* Ending date and time for the time log. Accepted formats: 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM', 'YYYY-MM-DD HH:MM:SS', 'YYYY-MM-DDTHH:MM', 'YYYY-MM-DDTHH:MM:SS'. Cannot be before timestamp. *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. *Required if isAbsence is true
workOrder String No Id of the work order
pricePerHour Number No price per hour of the time log. If not specified (or if the time log is not invoiceable), 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 or not
isAbsence Boolean No Should be set to true if it is an absence. For absences, the fields customer, workOrder, pricePerHour, invoiceableTime, supplementOrder and isInvoiceable are ignored and the absence is not invoiceable

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-07T14: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 No Id of the user on the time log. If not specified, the current user on the time log is kept

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. Time logs that have been invoiced or salary processed cannot be deleted.

HTTP Request

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

DELETE Parameters

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

Timers

Get Active Timers

curl "https://app.seventime.se/api/2/timers/?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/timers/?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": 2,
    "totalPages": 1,
    "currentPage": 1
  },
  "data": [
    {
      "startLocation": {
        "type": "Point",
        "coordinates": []
      },
      "_id": "670813733j31273j321j2",
      "startTimestamp": "2024-10-15T14:21:02.720Z",
      "realStartTimestamp": "2024-10-15T14:21:02.720Z",
      "machineTimeSupplements": [],
      "machineTimePrices": [],
      "user": "51718241fdb7084835249227"
    },
    {
      // ...
    }
  ]
}

This endpoint retrieves all active timers.

HTTP Request

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

Query Parameters

Parameter Default Description
user If specified, timers that match the parameter will be included.
customer If specified, timers that match the parameter will be included.
project If specified, timers that match the parameter will be included.
task If specified, timers that match the parameter will be included.
timeCategory If specified, timers that match the parameter will be included.
workOrder If specified, timers that match the parameter will be included.
limit 100 Number of timers per page. Maximum 500
page 1 Page number
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

Start a timer

curl -X POST "https://app.seventime.se/api/2/startTimer/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"user":"51718241fdb7084835249227"}'
let jsonData = {
  user: '51203146506d961c03036589741',
};

let options = {
  url: 'https://app.seventime.se/api/2/startTimer',
  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 start timer: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{
  "startLocation": {
    "type": "Point",
    "coordinates": []
  },
  "_id": "670813733j31273j321j2",
  "startTimestamp": "2024-10-15T14:21:02.720Z",
  "realStartTimestamp": "2024-10-15T14:21:02.720Z",
  "machineTimeSupplements": [],
  "machineTimePrices": [],
  "user": "51718241fdb7084835249227"
}

This endpoint starts a timer. A user can only have one active timer; if the user already has an active timer, an error is returned.

HTTP Request

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

POST Parameters

Parameter Type Required? Description
user String Yes Id of the user on the timer
customer String No Id of the customer
project String No Id of the project
workOrder String No Id of the work order
timeCategory String No Id of the time category
task String No Id of the task

Stop a Timer

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

let options = {
  url: 'https://app.seventime.se/api/2/stopTimer',
  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("Timer stopped and time log created: _id: " + body._id);
  } else {
    console.error("ERROR! Unable to stop timer: " + 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
}
"Timer stopped and time log created: _id: 51203146506d961c35798485"

This endpoint stops a timer and returns the created time log

HTTP Request

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

POST Parameters

Parameter Type Required? Description
_id String Yes* Id of the timer (*required if user is not specified)
user String Yes* Id of the user on the timer (*required if _id is not specified)

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,
      "department": null
    },
    {
      // ...
    }
  ]
}

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. The first word is matched against the first name and the second word (if any) against the last name
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
salaryType If specified, users with this default salary type id will be included.
userSkills If specified, users that match the parameter will be included.
limit 100 Number of users per page. Maximum 500
page 1 Page number
sortBy firstName 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:

{
  "_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,
  "department": null
}

This endpoint retrieves a specific user. Note that the user is returned directly and not wrapped in a data attribute.

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
limit 100 Maximum number of items to return. Maximum 500
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
limit 100 Maximum number of items to return. Maximum 500
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
limit 100 Maximum number of items to return. Maximum 500
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 work types.

HTTP Request

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

URL Parameters

Parameter Default Description
limit 100 Maximum number of items to return. Maximum 500
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","userRoleId":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 Number Yes User role id
personalNumber String No Personal number of the user
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. If specified, the user will be set as active and activated
sendActivationEmail Boolean No If true and no password is specified, an activation email is sent to the user
language String No Language of the user, 'SV' or 'EN'. If not specified, this will we set to SV.

The userName must be unique, otherwise an error is returned.

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",
  "userType": 1,
  "isActive": true,
  "isActivated": false,
  "language": "SV"
}
"User updated: Anna, _id: 5fb3e157f795553d0575597841"

This endpoint updates a specific user. The response contains the updated user object with its internal attribute names (e.g. userType for the user role id and personNumber for the personal number).

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
limit 100 Number of vehicles per page. Maximum 500
page 1 Page number

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/vehicles/<_id>

URL Parameters

Parameter Description
_id The _id of the vehicle to retrieve

Webhook Subscriptions

Webhook subscriptions let you receive a HTTP POST request to your own URL when something happens in Seven Time, e.g. when a work order is created or an invoice is updated. One subscription is created per event.

Available events

Event Description
workorder.created A work order was created
workorder.updated A work order was updated
project.created A project was created
project.updated A project was updated
customer.created A customer was created
customer.updated A customer was updated
invoice.created An invoice was created
invoice.updated An invoice was updated
invoice.sent An invoice was sent
quote.created A quote was created
quote.updated A quote was updated
quote.sent A quote was sent
quote.opened A quote was opened by the recipient
quote.approved A quote was approved
quote.rejected A quote was rejected
timelog.created A time log was created
timelog.updated A time log was updated
task.created A task was created
task.updated A task was updated

Webhook requests

A webhook request sent to your URL looks like this:

{
  "event": "workorder.created",
  "timestamp": "2024-01-15T08:00:00.000Z",
  "data": {
    "_id": "5bae34dca878b5497748",
    "title": "Service",
    "workOrderNumber": 1234
    // ...
  }
}

Verifying the signature in Node.js:

const crypto = require('crypto');

// rawBody is the raw request body as a string
const expectedSignature = crypto
  .createHmac('sha256', secret)
  .update(rawBody)
  .digest('hex');

const isValid = crypto.timingSafeEqual(
  Buffer.from(expectedSignature),
  Buffer.from(req.headers['x-seventime-signature'])
);

When an event occurs, Seven Time sends a POST request with a JSON body to the targetUrl of every active subscription for that event. The body contains:

Field Description
event The event that occurred, e.g. workorder.created
timestamp Date and time when the request was sent, in ISO 8601 format
data The object the event concerns. It has the same structure as when fetching the object from the corresponding endpoint, e.g. a work order for workorder.* events

Each request includes the header X-SevenTime-Signature. It is a hex encoded HMAC-SHA256 of the request body, signed with the secret of the subscription. Use it to verify that the request was sent by Seven Time.

Your endpoint should respond with a 2xx status code within 10 seconds. If the request fails, it is retried up to two more times: after 1 minute and after 5 more minutes. If your endpoint responds with 410 Gone, the subscription is deactivated and no further requests are sent.

Get Webhook Subscriptions

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

let url = "https://app.seventime.se/api/2/webhookSubscriptions/";
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": "65a50f80d1e44854f9c54321",
      "targetUrl": "https://example.com/seventime/webhook",
      "eventType": "workorder.created",
      "isActive": true,
      "createdAt": "2024-01-15T08:00:00.000Z"
    },
    {
      "_id": "65a50f80d1e44854f9c54322",
      "targetUrl": "https://example.com/seventime/old-webhook",
      "eventType": "invoice.sent",
      "isActive": false,
      "deactivatedAt": "2024-02-01T10:00:00.000Z",
      "deactivatedReason": "Webhook delivery received HTTP 410 Gone from https://example.com/seventime/old-webhook",
      "createdAt": "2024-01-15T08:00:00.000Z"
    }
  ]
}

This endpoint retrieves all webhook subscriptions. The secret of a subscription is not included.

HTTP Request

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

Get a specific Webhook Subscription

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

let url = "https://app.seventime.se/api/2/webhookSubscriptions/65a50f80d1e44854f9c54321";
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": "65a50f80d1e44854f9c54321",
    "targetUrl": "https://example.com/seventime/webhook",
    "eventType": "workorder.created",
    "isActive": true,
    "createdAt": "2024-01-15T08:00:00.000Z"
  }
}

This endpoint retrieves a specific webhook subscription. The secret of the subscription is not included.

HTTP Request

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

URL Parameters

Parameter Description
_id The _id of the webhook subscription to retrieve

Create a Webhook Subscription

curl -X POST "https://app.seventime.se/api/2/webhookSubscriptions/" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json" \
  -d '{"targetUrl":"https://example.com/seventime/webhook","event":"workorder.created"}'
let jsonData = {
  targetUrl: 'https://example.com/seventime/webhook',
  event: 'workorder.created'
};

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

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

The above command returns HTTP status 201 and JSON structured like this:

{
  "id": "65a50f80d1e44854f9c54321",
  "targetUrl": "https://example.com/seventime/webhook",
  "event": "workorder.created",
  "secret": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
  "createdAt": "2024-01-15T08:00:00.000Z"
}

This endpoint creates a webhook subscription. The subscription is active directly.

The response contains the secret used to sign the webhook requests. The secret is only returned when the subscription is created, so store it in a safe place.

HTTP Request

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

POST Parameters

Parameter Type Required? Description
targetUrl String Yes URL that will receive webhook requests. Must start with http:// or https://
event String Yes Event to subscribe to. See available events

Delete a Webhook Subscription

curl -X DELETE "https://app.seventime.se/api/2/webhookSubscriptions/65a50f80d1e44854f9c54321" \
  -H "Client-Secret: thisismysecretkey" \
  -H "Content-Type: application/json"
let options = {
  url: 'https://app.seventime.se/api/2/webhookSubscriptions/65a50f80d1e44854f9c54321',
  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);
  } else {
    console.error("ERROR! Unable to delete webhook subscription: " + error);
    console.error(body);
  }
});

The above command returns JSON structured like this:

{
  "result": true
}

This endpoint deletes a webhook subscription.

HTTP Request

DELETE https://app.seventime.se/api/2/webhookSubscriptions/<_id>

URL Parameters

Parameter Description
_id The _id of the webhook subscription to delete

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&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": 1772,
    "totalResourcesIsExact": true,
    "totalPages": 178,
    "currentPage": 1,
    "hasMore": true,
    "nextPage": 2
  },
  "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.

The result is paginated. meta.totalResources is capped at 2000; if there are more matching work orders, meta.totalResourcesIsExact is false and meta.totalPages is null. Use meta.hasMore and meta.nextPage to fetch the next page.

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 where the user with this id is a full time or part time resource will be included.
customer If specified, work orders that match the parameter will be included.
statusRef If specified, work orders with this status id will be included. Can be given multiple times to include several statuses
lastModified If specified, work orders that has been modified since the specified timestamp will be included. Accepted formats: 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM', 'YYYY-MM-DD HH:MM:SS', 'YYYY-MM-DDTHH:MM', 'YYYY-MM-DDTHH:MM:SS'. An invalid value returns HTTP status 400
limit 100 Number of work orders per page. Maximum 500
page 1 Page number
sortBy modifiedDate 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

No parameters. The tags are sorted by tagName.

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. Must be after startDate
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. All users must exist
machines Array No Array containing the ids of the machines which are working full time on the work order. All machines must exist
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 (only 5, 10, 20 and 30 can be set)
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
tags Array No Array containing the ids of the tags. Ids that do not match an existing work order tag are ignored

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 useOtherAddress is true
address String No Used if useOtherAddress is true
address2 String No Used if useOtherAddress is true
zipCode String No Used if useOtherAddress is true
city String No Used if useOtherAddress is true
country String No Used if useOtherAddress is true, given as a country code (E.g. SE for Sweden)
phone String No Used if useOtherAddress 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

The fields createdByUser and workOrderNumber cannot be changed and are ignored. The fields documents, checkLists, comments, invoiceRows, todoItems, relations, quote and quoteNumber are also ignored.

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

Zapier

Automation in Zapier is done with Triggers and Actions. Below are all triggers and actions available for Seven Time in Zapier.

Triggers

Contact persons

Customers

Invoices

Projects

Quotes

Tasks

Timer

Time logs

Users

Work orders

Actions

Contact persons

Customers

Invoices

Machines

Projects

Tasks

Timer

Time logs

Users

Work orders