exclude particular category in api

I just figured it out, just in case it might be helpful for anyone in future: There is an option available to exclude a particular category – categories_exclude So, the new rest API would be: https://www.example.com/?rest_route=/wp/v2/posts&per_page=100&categories_exclude=10

Adding Custom Endpoint in WordPress Rest API

Instead ID you should use cat_ID $data[$i][‘id’] = $category->cat_ID; get_categories() return list of category objects with: “term_id”: 7, “name”: “default”, “slug”: “default”, “term_group”: 0, “term_taxonomy_id”: 7, “taxonomy”: “category”, “description”: “”, “parent”: 0, “count”: 11, “filter”: “raw”, “cat_ID”: 7, “category_count”: 11, “category_description”: “”, “cat_name”: “Analiza”, “category_nicename”: “default”, “category_parent”: 0