Skip to content

Lists API getAll(), getByName(), and doSearch() only return results not tagged deleted (deletedAt not set) #486

@stvsimons

Description

@stvsimons

I'm not seeing anywhere in the HubSpot documentation or within the hubspot-api-php ListsApi code anything about the doSearch, getByName, and getAll methods only returning lists that have not been deleted (deletedAt is not set). Yet listsApi()->getById() will return non-deleted and deleted lists.

Is that an error? If that behavior is not an error, it would seem a significant oversight in there appears to be no ListsApi method to retrieve all lists - both non-deleted and deleted without knowing the deleted list ids.

Steps to reproduce:

$apiResponse = $client->crm()->lists()->listsApi()->getById('68', false);

{
  "list": {
    "listId": "68",
    "listVersion": 1,
    "createdAt": "2025-04-29T19:55:17.427Z",
    "updatedAt": "2025-05-02T21:00:14.271Z",
    "filtersUpdatedAt": "2025-05-02T19:27:02.547Z",
    "deletedAt": "2025-05-02T21:00:14.271Z",
    "processingStatus": "PROCESSING",
    "createdById": "5709857",
    "updatedById": "5709857",
    "processingType": "MANUAL",
    "objectTypeId": "0-1",
    "name": "Test List 04/29/25 14:55:17",
    "listPermissions": {
      "teamsWithEditAccess": [],
      "usersWithEditAccess": []
    },
    "membershipSettings": {
      "membershipTeamId": null,
      "includeUnassigned": null
    }
  }
}

But using fetch multiple lists method (passing the deleted list id "68" found above and another list id that is not deleted):

$apiResponse = $client->crm()->lists()->listsApi()->getAll(['68', '10'], false);

{
  "lists": [
    {
      "listId": "10",
      "listVersion": 1,
      "createdAt": "2024-05-20T18:11:39.227Z",
      "updatedAt": "2024-05-22T07:16:58.618Z",
      "filtersUpdatedAt": "2024-05-20T18:11:39.227Z",
      "processingStatus": "COMPLETE",
      "createdById": "5709857",
      "processingType": "MANUAL",
      "objectTypeId": "0-1",
      "name": "Sample Contact List",
      "size": 2,
      "listPermissions": {
        "teamsWithEditAccess": [],
        "usersWithEditAccess": []
      },
      "membershipSettings": {
        "membershipTeamId": null,
        "includeUnassigned": null
      }
    }
  ]
}

Using the getByName() method for the deleted list retrieved above with the getById() method:

$apiResponse = $client->crm()->lists()->listsApi()->getByName('Test List 04/29/25 14:55:17', '0-1', false);

{
  "status": "error",
  "message": "List does not exist with name Test List 04/29/25 14:55:17 and object type ID 0-1.",
  "correlationId": "b21df879-d024-41ec-b7b0-0d07de513db2",
  "context": {
    "listName": [
      "Test List 04/29/25 14:55:17"
    ],
    "objectTypeId": [
      "0-1"
    ]
  },
  "category": "OBJECT_NOT_FOUND",
  "subCategory": "ListError.LIST_NAME_DOES_NOT_EXIST"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions