> ## Documentation Index
> Fetch the complete documentation index at: https://hm-95ec977f.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Archive Note

> Archive a note by setting its archived status to true

# Archive Note

Archive a note by setting its `archived` status to `true`. Archived notes are hidden from regular views but can still be retrieved with filters.

## Path Parameters

<ParamField path="id" type="integer" required>
  The unique identifier of the note to archive
</ParamField>

## Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH "https://arfan-notes.val.run/api/notes/23/archive" \
    -H "Content-Type: application/json"
  ```

  ```javascript JavaScript theme={null}
  const noteId = 23;

  const response = await fetch(`https://arfan-notes.val.run/api/notes/${noteId}/archive`, {
    method: 'PATCH',
    headers: {
      'Content-Type': 'application/json'
    }
  });

  const archivedNote = await response.json();
  console.log(archivedNote);
  ```

  ```python Python theme={null}
  import requests

  note_id = 23

  response = requests.patch(
      f'https://arfan-notes.val.run/api/notes/{note_id}/archive',
      headers={'Content-Type': 'application/json'}
  )

  archived_note = response.json()
  print(archived_note)
  ```
</CodeGroup>

## Response

<ResponseExample>
  ```json Success Response theme={null}
  {
    "id": 23,
    "title": "Advanced CSS Techniques",
    "content": "Modern CSS techniques including Grid, Flexbox, and custom properties...",
    "category": "css",
    "group": "first",
    "color": "primary",
    "archived": true,
    "createdAt": "2024-01-25T14:30:00Z",
    "updatedAt": "2024-01-25T17:20:00Z"
  }
  ```

  ```json Error Response (Note Not Found) theme={null}
  {
    "error": "Note with ID 23 not found"
  }
  ```

  ```json Error Response (Already Archived) theme={null}
  {
    "error": "Note is already archived"
  }
  ```
</ResponseExample>

## Behavior

* Sets the `archived` field to `true`
* Updates the `updatedAt` timestamp
* Returns the complete updated note object
* Archived notes can still be retrieved using the filtered endpoint with `archived=true`

## Use Cases

* **Content Management**: Remove outdated notes from active views
* **Organization**: Keep historical notes without cluttering the main interface
* **Soft Delete**: Archive instead of permanently deleting notes
* **Workflow Management**: Mark completed or obsolete notes as archived

## Related Endpoints

* Use [Unarchive Note](/api/notes/unarchive-note) to restore an archived note
* Use [Get Filtered Notes](/api/notes/get-filtered-notes) with `archived=true` to retrieve archived notes
* Use [Get Filtered Notes](/api/notes/get-filtered-notes) with `archived=false` to exclude archived notes
