As an administrator, it's possible to update a link field to include or exclude specific entities. However, those rules only apply for the interface. If an administrator has determined that only certain entities should be available for linking, it seems odd that an API scriptwriter can bypass those rules and link any available entity. For consistency, updating the field rules for the interface should also set up a parallel rule for similar API updates (thereafter producing an error when attempting to make an illegal link).
Universal linking rules for interface and API updates.