# Using the ServiceM8 API, is there a way to rename files attached to filled-in forms?

**URL:** <https://community.servicem8.com/t/using-the-servicem8-api-is-there-a-way-to-rename-files-attached-to-filled-in-forms/388>\
**Category:** API & SDK\
**Created:** [June 25, 2024, 9:48pm UTC](https://community.servicem8.com/t/using-the-servicem8-api-is-there-a-way-to-rename-files-attached-to-filled-in-forms/388 "2024-06-25T21:48:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![developer](https://avatars.discourse-cdn.com/v4/letter/d/bcef8e/32.png) [@developer](https://community.servicem8.com/u/developer)\
**Post date:** [June 25, 2024, 9:48pm UTC](https://community.servicem8.com/t/using-the-servicem8-api-is-there-a-way-to-rename-files-attached-to-filled-in-forms/388/1 "2024-06-25T21:48:50Z")

</div>

**Originally posted by Luke**

ServiceM8 automatically names documents attached to filled-in forms using the pattern: “Form Name by User".

We have a client that has a lot of these with the same name, so we are inquiring if there’s a way to update the filename on ServiceM8 through the API?

---

<div class="post-metadata">

**Author:** ![developer](https://avatars.discourse-cdn.com/v4/letter/d/bcef8e/32.png) [@developer](https://community.servicem8.com/u/developer)\
**Post date:** [June 28, 2024, 11:13pm UTC](https://community.servicem8.com/t/using-the-servicem8-api-is-there-a-way-to-rename-files-attached-to-filled-in-forms/388/2 "2024-06-28T23:13:41Z")

</div>

Yes, can search for the file attachment and then can update the “attachment\_name”

To automate this process,you could set up a webhook on form submission or creation of file. then use the webhook data to filter out and retrieve the pdf file update the file name then update it

[https://developer.servicem8.com/reference/get-attachment-single](https://developer.servicem8.com/reference/get-attachment-single)

[https://developer.servicem8.com/reference/post-attachment-single](https://developer.servicem8.com/reference/post-attachment-single)

[https://developer.servicem8.com/reference/post\_webhook\_subscriptions](https://developer.servicem8.com/reference/post_webhook_subscriptions)

[https://developer.servicem8.com/reference/get-formresponse-single](https://developer.servicem8.com/reference/get-formresponse-single)
