---
title: "Attach a record to a note"
method: POST
path: "/public-api/v1/notes/{note_id}/links"
tags: ["Notes"]
---

# Attach a record to a note

`POST /public-api/v1/notes/{note_id}/links`

## Request

- Base URL: `https://app.hellobonsai.com`
- URL: `https://app.hellobonsai.com/public-api/v1/notes/{note_id}/links`
- Auth: one of:
  - OAuth 2
    - Authorization code: `https://app.hellobonsai.com/oauth/authorize`
    - Token URL: `https://app.hellobonsai.com/oauth/token`
  - HTTP bearer

Attaches a note you have already written to a client company, a project
or a contact. Find the id with `GET /public-api/v1/companies`,
`GET /public-api/v1/projects` or `GET /public-api/v1/contacts`.

Attaching is idempotent. Posting a pair the note already carries returns
`201` with the attachment that was there, and writes nothing — so a
retry after a timeout is safe and there is no duplicate to handle.

A note holds at most 10 records. Once it is full
any further record returns `422` pointed at the body rather than at
`record_id`, because a different id would fail the same way.

Attaching a record takes the same permission as editing the note, so
the person who wrote a note can always attach to it. `data.id` is what
addresses the attachment if you later want to remove it.

## Request body

- object
  - `link` object, required
    - `record_type` 'company' | 'project' | 'contact' | 'deal', required: Which kind of record to attach the note to.
    - `record_id` integer, required: Id of the record to attach, in the resource named by `record_type`.

## Response `201`

The record is attached. `data` carries the attachment, whether this call created it or it was already there.

- object
  - `data` NoteLink, required: The attachment between a note and one of the records it is written about.
    - `id` integer, required: Unique identifier for the attachment between the note and the record.
    - `record_id` integer, required: Id of the attached record, in the resource named by `record_type`.
    - `record_type` 'company' | 'project' | 'contact' | 'deal' | 'null', nullable, required: Which kind of record the note is attached to.
  - `meta` Meta, required: Metadata returned alongside every single-resource response.
    - `request_id` string, required: Identifier for this request. Quote it when contacting support about a specific call.

## Other responses

- `400`: The request body is missing its `link` wrapper.
- `401`: The access token is missing, expired or invalid.
- `403`: This token can see the note but is not allowed to edit it.
- `404`: No note with that `note_id` that this token can see.
- `422`: The attachment could not be made. `blank` means `record_type` or `record_id` was missing; `invalid_value` means `record_type` is not one of the published names, `record_id` is not a whole number, or the note is already full; `not_accessible` means `record_id` is not a record you can reach.
- `429`: Rate limit exceeded. Wait at least `Retry-After` seconds before trying again.

---

[API](https://skmtc.dev/hellobonsai/apis/bonsai-api.md) - [All operations](https://skmtc.dev/hellobonsai/apis/bonsai-api/llms.txt) - [OpenAPI document](https://skmtc.dev/hellobonsai/apis/bonsai-api/revisions/abf12ed6a8d3?raw)
