docket Documentation

Subject to changes

This documentation is subject to changes during the spring of 2026.

  1. Projects
  2. Project Files
  3. Socket

General information

All request should have a token from auth.emilfolino.se as the x-access-token-header.

Projects

All projects have the following attributes:

Get all projects

GET /projects

Code example

          const response = await fetch("https://docket.emilfolino.se/projects", {
  headers: {
    'x-access-token': [TOKEN],
  },
})
const result = await response.json()

Result:

{
  "data": [
    {
      "uid": "fb5a74fe51f39e0df0f928d7cd98445b",
      "name": "Starter project"
    },
    {
      "uid": "9d788496c6fabb77336cccd87844284d",
      "name": "Greatest project ever"
    }
  ]
}

Get project and all associated files and users

GET /projects/:uid

Code example

          const response = await fetch("https://docket.emilfolino.se/projects/fb5a74fe51f39e0df0f928d7cd98445b", {
  headers: {
    'x-access-token': [TOKEN],
  },
})
const result = await response.json()

Result:

{
    "data": {
        "uid": "fb5a74fe51f39e0df0f928d7cd98445b",
        "name": "Starter project",
        "files": [
            {
                "filename": "index.js",
                "uid": "fb5a74fe51f39e0df0f928d7cd98445b",
                "parent_file": null,
                "content": "console.log('docket')"
            }
        ],
        "users": [
            {
                "email": "efo@bth.se"
            }
        ]
    }
}

Create project

POST /projects

Code example

          const response = await fetch("https://docket.emilfolino.se/projects", {
  body: JSON.stringify({
    name: "Greatest project forever, forever-ever"
  }),
  method: "POST",
  headers: {
    'content-type': 'application/json',
    'x-access-token': [TOKEN],
  },
})
const result = await response.json()

Result:

{
  "data": {
    "uid": "296c53801cccf467a7afe4f10fc496e3",
    "name": "Greatest project forever, forever-ever"
  }
}

Add user to project

POST /projects/add_user

Code example

          const response = await fetch("https://docket.emilfolino.se/projects/add_user", {
  body: JSON.stringify({
    uid: "296c53801cccf467a7afe4f10fc496e3",
    email: "mos@bth.se",
  }),
  method: "POST",
  headers: {
    'content-type': 'application/json',
    'x-access-token': [TOKEN],
  },
})
const result = await response.json()

Remove user from project

DELETE /projects/remove_user

Code example

              const response = await fetch("https://docket.emilfolino.se/projects/remove_user", {
      body: JSON.stringify({
        uid: "296c53801cccf467a7afe4f10fc496e3",
        email: "mos@bth.se",
      }),
      method: "DELETE",
      headers: {
        'content-type': 'application/json',
        'x-access-token': [TOKEN],
      },
    })
    
    

Result:

204 No Content

Delete project and associated files

DELETE /projects

Code example

          const response = await fetch("https://docket.emilfolino.se/projects", {
  body: JSON.stringify({
    uid: "34072bf5da897bfaf28891260f091dd2",
  }),
  method: "DELETE",
  headers: {
    'content-type': 'application/json',
    'x-access-token': [TOKEN],
  },
})
const result = await response.json()

Result:

204 No Content

Project files

All files have the following attributes:

Create file in project

POST /files

Code example

          const response = await fetch("https://docket.emilfolino.se/files", {
  body: JSON.stringify({
    filename: "style.css",
    project_uid: "fb5a74fe51f39e0df0f928d7cd98445b",
    parent_file: null,
  }),
  method: "POST",
  headers: {
    'content-type': 'application/json',
    'x-access-token': [TOKEN],
  },
})
const result = await response.json()

Result:

{
  "data": {
    "filename": "style.css",
    "uid": "0f784d640ac6ae249823efd991655444",
    "project_uid": "fb5a74fe51f39e0df0f928d7cd98445b",
    "parent_file": null,
    "content": "",
    "last_changed": "2026-04-13T06:32:55.887Z"
  }
}

Delete file

DELETE /files

Code example

          const response = await fetch("https://docket.emilfolino.se/files", {
  body: JSON.stringify({
    uid: "14fa4776c6d78755ad933d6b5ed9fc47",
  }),
  method: "DELETE",
  headers: {
    'content-type': 'application/json',
    'x-access-token': [TOKEN],
  },
})
const result = await response.json()

Result:

204 No Content

Socket

For all socket-endpoints a valid token from auth.emilfolino.se should be attached like the endpoints above. The following code example shows how to attach the token.

          // src/models/socket.js
import { io } from "socket.io-client"
import auth from "./auth.js"

const URL = "https://docket.emilfolino.se"

export const socket = io(URL, {
  auth: {
    token: auth.token
  }
})

Open a file

To create a socket.io-room emit a load file-event from the client containing the file uid.

socket.emit('open file', uid)

Two events will be emitted from the server to the specific room after a file is opened by any client. A file loaded-event and a users-event with an updated users list.

Close a file

To leave the room and close the file, emit a close file-event.

socket.emit('close file', uid)

A users-event will be send to all remaining clients with the remaining users.

Updating content

To update content from the client send an emit with the content-event.

          socket.emit("content", { 
  content: newContent,
  uid: uid,
})

The data is broadcasted back to all clients in the room using the same content-event.

The content is automatically stored in the database after the user have not typed for 2 seconds. A content saved-event is sent to all clients after the content is stored. The last_changed attribute is updated at this point.

Selection

To send updates for selection, send an emit with the selection-event.

          socket.emit('selection', { 
  data: selectionData,
  uid: uid,
})

The data is broadcasted back to all clients in the room using the same selection-event.