# How to create artifact using management APIs with state scripts

**URL:** <https://hub.mender.io/t/how-to-create-artifact-using-management-apis-with-state-scripts/5993>\
**Category:** General Discussions\
**Tags:** state-scripts, mender-artifact\
**Created:** [July 10, 2023, 11:49am UTC](https://hub.mender.io/t/how-to-create-artifact-using-management-apis-with-state-scripts/5993 "2023-07-10T11:49:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nareshtech20](https://avatars.discourse-cdn.com/v4/letter/n/46a35a/32.png) [@nareshtech20](https://hub.mender.io/u/nareshtech20)\
**Post date:** [July 10, 2023, 11:49am UTC](https://hub.mender.io/t/how-to-create-artifact-using-management-apis-with-state-scripts/5993/1 "2023-07-10T11:49:13Z")

</div>

How to create artifact using management APIs with state scripts ?

Don’t see any option to include state script in following API,  
[https://hosted.mender.io/api/management/v1/deployments/artifacts/generate](https://hosted.mender.io/api/management/v1/deployments/artifacts/generate)

Regards,  
Naresh

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [July 10, 2023, 7:30pm UTC](https://hub.mender.io/t/how-to-create-artifact-using-management-apis-with-state-scripts/5993/2 "2023-07-10T19:30:22Z")

</div>

Hi @nareshtech20,

State scripts are included in an artifact during the creation process. You can add an arbitrary number by giving the `--script` (or short `-s`) parameter, followed by the script path to `mender-artifact`. You can get more information on the functionality of the tool by using the `-h` flag to print the help sections.

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![nareshtech20](https://avatars.discourse-cdn.com/v4/letter/n/46a35a/32.png) [@nareshtech20](https://hub.mender.io/u/nareshtech20)\
**Post date:** [July 11, 2023, 3:59am UTC](https://hub.mender.io/t/how-to-create-artifact-using-management-apis-with-state-scripts/5993/3 "2023-07-11T03:59:57Z")

</div>

Hi @TheYoctoJester ,

Have used mender-artifact cli for artifact creation manually, but as per organization compliance, process calls from micro service applications should be avoided, hence looking for Rest API.  
Have used “[https://hosted.mender.io/api/management/v1/deployments/artifacts/generate](https://hosted.mender.io/api/management/v1/deployments/artifacts/generate)” API for artifact creation, can’t find any script option, anything I’m missing here ?

Thanks,  
Naresh

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [July 11, 2023, 6:42am UTC](https://hub.mender.io/t/how-to-create-artifact-using-management-apis-with-state-scripts/5993/4 "2023-07-11T06:42:58Z")

</div>

Hi @nareshtech20,

As pointed out in the [documentation](https://docs.mender.io/api/#management-api-deployments-generate-artifact) this is only suitable for generating single file Artifact, and does not support additional parameters or scripts. The rationale behind is being able to upload a single file to the dashboard and having it packaged as an artifact.

If your company has specific needs for compliance and architecture, it might be a good idea to get in touch with our team for professional services.

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![nareshtech20](https://avatars.discourse-cdn.com/v4/letter/n/46a35a/32.png) [@nareshtech20](https://hub.mender.io/u/nareshtech20)\
**Post date:** [July 11, 2023, 7:04am UTC](https://hub.mender.io/t/how-to-create-artifact-using-management-apis-with-state-scripts/5993/5 "2023-07-11T07:04:34Z")

</div>

Thank you @TheYoctoJester, sure will check options.
