# How to create elastic Agent Policy and Toekns using Curl

**URL:** <https://discuss.elastic.co/t/how-to-create-elastic-agent-policy-and-toekns-using-curl/335482>\
**Category:** Elastic Agent\
**Created:** [June 7, 2023, 10:16pm UTC](https://discuss.elastic.co/t/how-to-create-elastic-agent-policy-and-toekns-using-curl/335482 "2023-06-07T22:16:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kos/32/121987_2.png) [@kos](https://discuss.elastic.co/u/kos)\
**Post date:** [June 7, 2023, 10:16pm UTC](https://discuss.elastic.co/t/how-to-create-elastic-agent-policy-and-toekns-using-curl/335482/1 "2023-06-07T22:16:34Z")

</div>

Trying to setup automatic sandbox environment that requires destroy and rebuild quiet often.  
Every time building the sandbox using the docker compose had to manually login to the GUI and add fleet host, create fleet policy, create agent policy, enrolment tokens manually.

What are the Equivalent API for Generate Fleet Server Policy, Agent Policy, Fleet Service Token, Elastic Agent Enrolment Token, Add Fleet Server

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2023, 10:16pm UTC](https://discuss.elastic.co/t/how-to-create-elastic-agent-policy-and-toekns-using-curl/335482/2 "2023-07-05T22:16:51Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
