I cannot find documentation about Entity, I have managed to make this work using ids of contacts but I do not know if any other kind of filter is possible. Specifically, I would like to know if I can export contacts filtered by a custom field.
Is it possible to export all contacts, without any filter?
Bulk fetch of contacts only works with entity containing the id of the external contact. Bulk Fetch is described here.
Bulk don't have a search/filter mechanism.
You would have to search contacts.
I haven't used it recently but GET /api/v2/externalcontacts/contacts should allow you to search for contacts with a specific value. The search will compare the provided value to contact attributes, including Custom fields of type Identifier/Tag/Text/Text.
See the Custom field types page on the Resource Center - which specifies if the field type is searchable or not.