From 40d11b23f43db1fff8a2c868064bea1d56396e5f Mon Sep 17 00:00:00 2001 From: drish Date: Wed, 17 Jun 2026 15:50:56 -0300 Subject: [PATCH 1/3] fix: segments in contact imports should be array of objects --- examples/contact_imports.py | 2 +- resend/contacts/imports/_contact_imports.py | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/examples/contact_imports.py b/examples/contact_imports.py index e2857e9..5b5f24d 100644 --- a/examples/contact_imports.py +++ b/examples/contact_imports.py @@ -25,7 +25,7 @@ }, }, "on_conflict": "upsert", - "segments": ["60a2ac5e-0774-456e-817d-ebf40f6dba31"], + "segments": [{"id": "60a2ac5e-0774-456e-817d-ebf40f6dba31"}], "topics": [ { "id": "6eb54030-9489-4e9c-8de6-cd337c5fef1e", diff --git a/resend/contacts/imports/_contact_imports.py b/resend/contacts/imports/_contact_imports.py index 0b3b392..93c076e 100644 --- a/resend/contacts/imports/_contact_imports.py +++ b/resend/contacts/imports/_contact_imports.py @@ -61,10 +61,11 @@ class CreateParams(TypedDict): """ Strategy when an imported contact already exists: 'upsert' or 'skip' (default 'skip'). """ - segments: NotRequired[List[str]] + segments: NotRequired[List[Dict[str, str]]] """ - List of segment IDs to add imported contacts to. - Will be serialized as [{"id": "..."}] before sending. + List of segment objects to add imported contacts to. + Each entry must have an 'id' key with the segment UUID. + Example: [{"id": "60a2ac5e-0774-456e-817d-ebf40f6dba31"}] """ topics: NotRequired[List[Dict[str, str]]] """ @@ -106,9 +107,7 @@ def _build_multipart( if "on_conflict" in params: form_data["on_conflict"] = params["on_conflict"] if "segments" in params: - form_data["segments"] = json_lib.dumps( - [{"id": sid} for sid in params["segments"]] - ) + form_data["segments"] = json_lib.dumps(params["segments"]) if "topics" in params: form_data["topics"] = json_lib.dumps(params["topics"]) return files, form_data From 64a567180168f37e1da3f59712dae92b230870b1 Mon Sep 17 00:00:00 2001 From: drish Date: Wed, 17 Jun 2026 15:52:36 -0300 Subject: [PATCH 2/3] chore: bump version to 2.32.1 --- resend/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resend/version.py b/resend/version.py index ca53631..8cc7fab 100644 --- a/resend/version.py +++ b/resend/version.py @@ -1,4 +1,4 @@ -__version__ = "2.32.0" +__version__ = "2.32.1" def get_version() -> str: From 57c35cb3c78a75a3173f836a9e972b2fa387e572 Mon Sep 17 00:00:00 2001 From: drish Date: Wed, 17 Jun 2026 15:54:05 -0300 Subject: [PATCH 3/3] fix: update segments type in contact imports test --- tests/contact_imports_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/contact_imports_test.py b/tests/contact_imports_test.py index de26645..248ef88 100644 --- a/tests/contact_imports_test.py +++ b/tests/contact_imports_test.py @@ -27,7 +27,7 @@ def test_create_contact_import_with_options(self) -> None: "filename": "contacts.csv", "on_conflict": "upsert", "column_map": {"email": "email", "first_name": "first_name"}, - "segments": ["seg-123"], + "segments": [{"id": "seg-123"}], } resp = resend.Contacts.Imports.create(params) assert resp["id"] == "479e3145-dd38-476b-932c-529ceb705947"