# API Form submission with ticket automatically generated

**URL:** <https://community.hubspot.com/t/api-form-submission-with-ticket-automatically-generated/20866>\
**Category:** APIs & Integrations\
**Tags:** forms\
**Created:** [May 14, 2020, 11:16am UTC](https://community.hubspot.com/t/api-form-submission-with-ticket-automatically-generated/20866 "2020-05-14T11:16:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jrpersico](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jrpersico/32/7115_2.png) [@Jrpersico](https://community.hubspot.com/u/Jrpersico)\
**Post date:** [May 14, 2020, 11:16am UTC](https://community.hubspot.com/t/api-form-submission-with-ticket-automatically-generated/20866/1 "2020-05-14T11:16:09Z")

</div>

Hi,

Is it possible to send ticket data to a form via api form submission like this :

```auto
// Create the new request
 var xhr = new XMLHttpRequest();
 var url = 'https://api.hsforms.com/submissions/v3/integration/submit/id/id // Example request JSON:
 var data = {
 "submittedAt": Date.now(),
 "fields": [
 {
 "name": "email",
 "value": this.email
 },
 {
 "name": "firstname",
 "value": this.firstname
 },
 {
 "name": "lastname",
 "value": this.lastname
 },
 {
 "name": "company",
 "value": this.company
 },
 {
 "name": "jobtitle",
 "value": this.job
 },
 {
 "name": "phone",
 "value": this.formatted_phone
 },
 {
 "name": "TICKET.subject",
 "value": "Contact"
 },
 {
 "name": "TICKET.content",
 "value": this.message
 }
 ],
 "context": {
 "pageUri": "https://spurred.io/contact-us",
 "pageName": "Contact us"
 },
 "legalConsentOptions":{ // Include this object when GDPR options are enabled
 "consent":{
 "consentToProcess": this.process_data,
 "text":"I agree to allow to store and process my personal data.",
 "communications":[
 {
 "value": this.communication,
 "subscriptionTypeId":999,
 "text":"I agree to receive marketing communications from."
 }
 ]
 }
 }
 }

```

When I try i got this error : “Error in ‘fields.TICKET.content’. Field ‘TICKET.content’ isn’t in form definition”,“errorType”:“FIELD\_NOT\_IN\_FORM\_DEFINITION”

---

<div class="post-metadata">

**Author:** ![Willson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/willson/32/84663_2.png) [@Willson](https://community.hubspot.com/u/Willson)\
**Post date:** [May 14, 2020, 12:10pm UTC](https://community.hubspot.com/t/api-form-submission-with-ticket-automatically-generated/20866/2 "2020-05-14T12:10:03Z")

</div>

Hi @Jrpersico

Currently whilst it is possible to submit submissions and pass some ticket information to your Portal, the Forms API is not designed nor optimised to handle this data and so it would not work as desired.

It is our current recommendation that if you wish to automate ticket actions with Form Data, you use our Forms API and [Ticket API](https://developers.hubspot.com/docs/methods/tickets/tickets-overview) together.

I hope this helps!
