User Notes API

Get a list of notes in the user's workspace

  • GET /notes
  • Success Response
    • code: 200
    • body:
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹    [
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       {
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "id": "ehgwc6a8RXSmcSaRwIQ2jw",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "title": "Personal note title",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "tags": ["personal", "test"],
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "createdAt": 1643270371245,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "publishType": "view",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "publishedAt": null,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "permalink": null,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "shortId": "SysJb0yAY",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "lastChangedAt": 1643270452413,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "lastChangeUser": {
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹              "name": "James",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹              "photo": "https://avatars.githubusercontent.com/u/26138990?s=96",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹              "biography": null,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹              "userPath": "AMQ36J15QgCZf46ThEFadg"
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          },
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "userPath": "AMQ36J15QgCZf46ThEFadg",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "teamPath": null,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "readPermission": "guest",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "writePermission": "signed_in",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "publishLink": "https://hackmd.io/@username/permalink"
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        }
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹     ]
      

Get a note

  • GET /notes/:noteId
  • URL Params:
    • noteId: string
  • Success Response
    • code: 200
    • body:
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹    {
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        "id": "ehgwc6a8RXSmcSaRwIQ2jw",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        "title": "Personal note title",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        "tags": [
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹            "Personal",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹            "test"
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        ],
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        "createdAt": 1643270371245,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        "publishType": "view",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        "publishedAt": null,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        "permalink": null,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        "shortId": "SysJb0yAY",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        "content": "# Personal note title\n###### tags: `Personal` `test`",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        "lastChangedAt": 1644461594806,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        "lastChangeUser": {
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹            "name": "James",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹            "photo": "https://avatars.githubusercontent.com/u/26138990?s=96",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹            "biography": null,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹            "userPath": "AMQ36J15QgCZf46ThEFadg"
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        },
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        "userPath": "AMQ36J15QgCZf46ThEFadg",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        "teamPath": null,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        "readPermission": "guest",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        "writePermission": "signed_in",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        "publishLink": "https://hackmd.io/@username/permalink"                
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹    }
      

Create a note

  • POST /notes
  • Data Params
    • body (optional) [application/json]

      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹{
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹    "title": "New note",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹    "content": "",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹    "readPermission": "owner",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹    "writePermission": "owner",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹    "commentPermission": "everyone"
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹}
      
      field type values
      title string
      content string
      readPermission string owner, signed_in, guest
      writePermission string owner, signed_in, guest
      commentPermission string disabled, forbidden, owners, signed_in_users, everyone
      permalink string
    • Success Response

      • code: 201
      • body:
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹   {
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       "id": "ppZ6pJ9iRFa7RHHUegcLiQ",
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       "title": "New note",
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       "tags": null,
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       "createdAt": 1644461842833,
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       "publishType": "view",
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       "publishedAt": null,
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       "permalink": null,
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       "shortId": "HyiMJWMk9",
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       "content": "test",
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       "lastChangedAt": 1644461842832,
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       "lastChangeUser": {
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹           "name": "James",
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹           "photo": "https://avatars.githubusercontent.com/u/26138990?s=96",
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹           "biography": null,
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹           "userPath": "AMQ36J15QgCZf46ThEFadg"
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       },
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       "userPath": "AMQ36J15QgCZf46ThEFadg",
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       "teamPath": null,
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       "readPermission": "owner",
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       "writePermission": "owner",
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹       "publishLink": "https://hackmd.io/@username/permalink"                    
        โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹   }
        

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More โ†’
Notes on the Title field

As for now, the title of a note is derived from the content, thus the behavior of "title" field may need further explanation.

  1. If there's a H1 header in the "content" field, then it will be used as the title of the note to be created.
  2. If there's no H1 header in the "content" field, yet a title is assigned in YAML metadata section (---\ntitle: abc\n---), then it will be the title of the note.
  3. If the "content" field is not included, then either look for the "title" field or create the note as "Untitled" when it is absent.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More โ†’
Notes on the permission field

  1. When creating or updating the note's permission, both readPermission and writePermission field must be provided at the same time.
  2. writePermission must be stricter than readPermission field. For example, a signed_in user readable note, you can set owner or signed_in writable permission, but you can't set guest writable permission for that note.

Update a note

  • PATCH /notes/:noteId
  • URL Params:
    • noteId: string
  • Data Params:
  • body (optional) [application/json]
    โ€‹โ€‹โ€‹โ€‹  {
    โ€‹โ€‹โ€‹โ€‹    "content": "# Updated personal note",
    โ€‹โ€‹โ€‹โ€‹    "readPermission": "signed_in",
    โ€‹โ€‹โ€‹โ€‹    "writePermission": "owner",
    โ€‹โ€‹โ€‹โ€‹    "permalink": "note-permalink"
    โ€‹โ€‹โ€‹โ€‹  }
    
    field type values
    content string
    readPermission string owner, signed_in, guest
    writePermission string owner, signed_in, guest
    permalink string
  • Success Response
    • code: 202
    • body: Accepted

Delete a note

  • DELETE /notes/:noteId
  • URL Params:
    • noteId: string
  • Success Response
    • code: 204

Get a history of read notes

  • GET /history
  • Success Response
    • code: 200
    • body:
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹      [
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        {
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "id": "0jJVr2b3T2eSkBnMib-inA",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "title": "Team notes",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "tags": [],
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "createdAt": 1644371283239,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "publishType": "view",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "publishedAt": 1644371283239,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "permalink": null,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "shortId": "SysUa9xJc",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "lastChangedAt": 1644461300662,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "lastChangeUser": {
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹              "name": "James",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹              "photo": "https://avatars.githubusercontent.com/u/26138990?s=96",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹              "biography": null,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹              "userPath": "AMQ36J15QgCZf46ThEFadg"
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          },
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "userPath": null,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "teamPath": "CAT",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "readPermission": "guest",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "writePermission": "signed_in",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "publishLink": "https://hackmd.io/@username/permalink"                  
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹      },
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹      {
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "id": "QpS6V2TCSbeKmNIS1LOrNQ",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "title": "Untitled",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "tags": null,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "createdAt": 1644393142405,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "publishType": "view",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "publishedAt": null,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "permalink": null,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "shortId": "HJAnGgZyq",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "lastChangedAt": 1644393142403,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "lastChangeUser": {
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹              "name": "Ming-Hsiu Tsai",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹              "photo": "https://avatars.githubusercontent.com/u/26138990?s=96",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹              "biography": null,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹              "userPath": "AMQ36J15QgCZf46ThEFadg"
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          },
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "userPath": "AMQ36J15QgCZf46ThEFadg",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "teamPath": null,
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "readPermission": "owner",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "writePermission": "owner",
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹          "publishLink": "https://hackmd.io/@username/permalink"                
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹        }
      โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹      ]
      

Upload attachments to a note (To be announced)

  • POST /notes/:noteId/upload
  • file: xxx