How to use API to implement a select all mask?

Why is the mask recognized as "image" but when I use the API to select all images, the mask is not selected, so how can I use the API to select all masks?