--- displayed_sidebar: jsClientSidebar slug: /references/js-client/AdminNotesResource --- import ParameterTypes from "@site/src/components/ParameterTypes" # AdminNotesResource This class is used to send requests to [Admin Note API Routes](https://docs.medusajs.com/api/admin#notes). All its method are available in the JS Client under the `medusa.admin.notes` property. All methods in this class require [user authentication](AdminAuthResource.mdx#createsession). Notes are created by admins and can be associated with any resource. For example, an admin can add a note to an order for additional details or remarks. ## Methods #### create Create a Note which can be associated with any resource. ##### Example ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.notes .create({ resource_id, resource_type: "order", value: "We delivered this order", }) .then(({ note }) => { console.log(note.id) }) ``` ##### Parameters `", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> ##### Returns `", "description": "An optional key-value map with additional details", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "resource_id", "type": "`string`", "description": "The ID of the resource that the Note refers to.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "resource_type", "type": "`string`", "description": "The type of resource that the Note refers to.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "updated_at", "type": "`Date`", "description": "The date with timezone at which the resource was updated.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "value", "type": "`string`", "description": "The contents of the note.", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ] } ] } ] } ]} /> ___ #### delete Delete a Note. ##### Example ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.notes.delete(noteId).then(({ id, object, deleted }) => { console.log(id) }) ``` ##### Parameters `", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> ##### Returns ___ #### list Retrieve a list of notes. The notes can be filtered by fields such as `resource_id` passed in the `query` parameter. The notes can also be paginated. ##### Example To list notes: ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.notes.list().then(({ notes, limit, offset, count }) => { console.log(notes.length) }) ``` By default, only the first `50` records are retrieved. You can control pagination by specifying the `limit` and `offset` properties: ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.notes .list({ limit, offset, }) .then(({ notes, limit, offset, count }) => { console.log(notes.length) }) ``` ##### Parameters `", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> ##### Returns `", "description": "An optional key-value map with additional details", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "resource_id", "type": "`string`", "description": "The ID of the resource that the Note refers to.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "resource_type", "type": "`string`", "description": "The type of resource that the Note refers to.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "updated_at", "type": "`Date`", "description": "The date with timezone at which the resource was updated.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "value", "type": "`string`", "description": "The contents of the note.", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ] } ] } ] } ]} /> ___ #### retrieve Retrieve a note's details. ##### Example ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.notes.retrieve(noteId).then(({ note }) => { console.log(note.id) }) ``` ##### Parameters `", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> ##### Returns `", "description": "An optional key-value map with additional details", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "resource_id", "type": "`string`", "description": "The ID of the resource that the Note refers to.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "resource_type", "type": "`string`", "description": "The type of resource that the Note refers to.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "updated_at", "type": "`Date`", "description": "The date with timezone at which the resource was updated.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "value", "type": "`string`", "description": "The contents of the note.", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ] } ] } ] } ]} /> ___ #### update Update a Note's details. ##### Example ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.notes .update(noteId, { value: "We delivered this order", }) .then(({ note }) => { console.log(note.id) }) ``` ##### Parameters `", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> ##### Returns `", "description": "An optional key-value map with additional details", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "resource_id", "type": "`string`", "description": "The ID of the resource that the Note refers to.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "resource_type", "type": "`string`", "description": "The type of resource that the Note refers to.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "updated_at", "type": "`Date`", "description": "The date with timezone at which the resource was updated.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "value", "type": "`string`", "description": "The contents of the note.", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ] } ] } ] } ]} />