# Notes search and CorrelationId error

**URL:** <https://community.hubspot.com/t/notes-search-and-correlationid-error/102078>\
**Category:** APIs & Integrations\
**Tags:** python\
**Created:** [March 8, 2024, 2:34pm UTC](https://community.hubspot.com/t/notes-search-and-correlationid-error/102078 "2024-03-08T14:34:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mfed\_303](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@mfed\_303](https://community.hubspot.com/u/mfed_303)\
**Post date:** [March 8, 2024, 2:34pm UTC](https://community.hubspot.com/t/notes-search-and-correlationid-error/102078/1 "2024-03-08T14:34:30Z")

</div>

I have the following code block to search for notes created on a specific date. Unfortunately, after paging through 10000 results, i get the following error:

`Status code: 400, Message: {"status":"error","message":"There was a problem with the request.","correlationId":"83d14a7c-7a68-45f2-8f21-765f1a81508c"}`

```lia-code-sample
import requests
import time
import json

def search_hubspot_notes(api_key, start_date, end_date):
 search_url = 'https://api.hubapi.com/crm/v3/objects/notes/search'
 # Headers for the request
 headers = {
 "Content-Type": "application/json",
 "Authorization": f"Bearer {api_key}" # Use your API key or OAuth token
 }

 # The payload for the search request, with 'limit' set to 100 for maximum results per page
 search_payload = {
 "filterGroups": [{
 "filters": [{
 "propertyName": "hs_createdate",
 "operator": "BETWEEN",
 "value": start_date,
 "highValue": end_date
 }]
 }],
 "properties": ["hs_note_body", "hs_timestamp", "hs_createdate", "hs_lastmodifieddate", "id", "hs_createdby_user_id"],
 "limit": 100 # Maximum limit allowed by HubSpot to maximize results per page
 }

 all_notes = []
 has_more = True
 after = 0 # Initial 'after' parameter for pagination, starts with 0
 pagination_count = 0 # Counter for the number of paginations

 while has_more:
 search_payload["after"] = after
 try:
 response = requests.post(search_url, headers=headers, json=search_payload)

 if response.status_code == 200:
 pagination_count += 1
 data = response.json()
 all_notes.extend(data.get("results", []))
 # Update 'has_more' based on the presence of 'paging.next.after'
 has_more = data.get("paging", {}).get("next", {}).get("after") is not None
 if has_more:
 after = data["paging"]["next"]["after"]
 else:
 print(f"Failed to retrieve notes. Status code: {response.status_code}, Message: {response.text}")
 print(f"Request details:\nURL: {response.request.url}\nMethod: {response.request.method}")
 print(f"Headers: {response.request.headers}\nPayload: {json.dumps(search_payload, indent=4)}")
 break
 except requests.exceptions.RequestException as e:
 print(f"Request failed: {e}")
 break

 # Handle rate limiting by sleeping then retrying
 if response.status_code == 429:
 retry_after = int(response.headers.get("Retry-After", 10)) # Default retry after 10 seconds if header is missing
 print(f"Rate limit hit, sleeping for {retry_after} seconds")
 time.sleep(retry_after)
 continue

 print(f"Completed {pagination_count} paginations.")
 return all_notes

# Use your actual API key or OAuth token here
api_key = 'Test'
start_date = "2024-03-06T00:00:00.000Z"
end_date = "2024-03-07T00:00:00.000Z"

# Fetch notes
notes = search_hubspot_notes(api_key, start_date, end_date)

# Print the outcome
print(f"Found {len(notes)} notes created between {start_date} and {end_date}")

```

It’s fairly ambiguous and I’m not sure what the correlationID has to do with it.

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [March 8, 2024, 6:11pm UTC](https://community.hubspot.com/t/notes-search-and-correlationid-error/102078/2 "2024-03-08T18:11:29Z")

</div>

Hey, [@mfed\_303](https://community.hubspot.com/t5/user/viewprofilepage/user-id/689525) 👋 You’re getting the expected error when trying to search beyond 10,000 records. From the Search API documentation \> [Limitations](https://developers.hubspot.com/docs/api/crm/search#limitations):  
“The search endpoints are limited to 10,000 total results for any given query. Attempting to page beyond 10,000 will result in a 400 error.”

I hope this helps get you moving forward! — Jaycee

---

<div class="post-metadata">

**Author:** ![JEdwards71](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@JEdwards71](https://community.hubspot.com/u/JEdwards71)\
**Post date:** [April 1, 2025, 8:00am UTC](https://community.hubspot.com/t/notes-search-and-correlationid-error/102078/3 "2025-04-01T08:00:10Z")

</div>

That CorrelationId error usually pops up when something goes wrong server-side or the API doesn’t understand the request—often due to a missing or incorrect parameter. If you’re searching notes using the Engagements API, double-check that you’re passing the correct object type and using supported filters. Sometimes even a small formatting issue in the request body can trigger that kind of generic error.
