# Hubspot API forms.

**URL:** <https://community.hubspot.com/t/hubspot-api-forms/84555>\
**Category:** CMS Development\
**Tags:** forms\
**Created:** [July 3, 2023, 9:41am UTC](https://community.hubspot.com/t/hubspot-api-forms/84555 "2023-07-03T09:41:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NTariq](https://avatars.discourse-cdn.com/v4/letter/n/ac91a4/32.png) [@NTariq](https://community.hubspot.com/u/NTariq)\
**Post date:** [July 3, 2023, 9:41am UTC](https://community.hubspot.com/t/hubspot-api-forms/84555/1 "2023-07-03T09:41:31Z")

</div>

Hi, I hope all are doing well. I create custom form in hubspot and implement hubspot api to store its information. But i can only store its email and name categories. I can’t store the subscribtion type information through custom hubspot form api. Please can someone let me know how i can store its subscription types alos through hubspot api’s. Thank you in advance

 ![MicrosoftTeams-image (5).jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/d/4/d45e733f445fe01fc4bbaa5be4d96e8866c33740.jpeg)

---

<div class="post-metadata">

**Author:** ![GRajput](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/grajput/32/102020_2.png) [@GRajput](https://community.hubspot.com/u/GRajput)\
**Post date:** [July 3, 2023, 11:35am UTC](https://community.hubspot.com/t/hubspot-api-forms/84555/2 "2023-07-03T11:35:06Z")

</div>

Hi @NTariq

To store subscription type information through the HubSpot API when using a custom form, you can make use of the HubSpot Contact Properties. Follow these steps:

1. **Create Custom Property:** In your HubSpot account, navigate to “Settings” → “Properties” → “Contacts”. Click on “Create a property” to create a custom property to store the subscription type information. Provide a name for the property, select the appropriate field type (e.g., single-line text, dropdown, checkboxes), and save the property.

2. **Include the Property in the Form:** Edit your custom form and add a field that corresponds to the subscription type property you created. This field can be a text input, dropdown, or checkbox group, depending on the property type. Make sure to map this field to the correct HubSpot property.

3. **Update the API Integration:** When submitting the form data to the HubSpot API, ensure that you include the subscription type information as a field in the API request payload. The field should match the name of the property you created in HubSpot.

Here’s an example of how you can update your API integration code to include the subscription type information:

```python  
import requests

api\_key = ‘YOUR\_API\_KEY’  
url = ‘[https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/{contact\_email}/](https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/%7Bcontact_email%7D/)’

headers = {  
‘Authorization’: f’Bearer {api\_key}',  
‘Content-Type’: ‘application/json’  
}

contact\_email = ‘example@example.com’  
subscription\_type = ‘Weekly Newsletter’

data = {  
‘properties’: [  
{  
‘property’: ‘subscription\_type’,  
‘value’: subscription\_type  
}  
]  
}

response = requests.post(url.format(contact\_email=contact\_email), headers=headers, json=data)

if response.status\_code == 200:  
# Successful request  
print(“Subscription type information stored successfully!”)  
else:  
# Request failed  
print(f"Error {response.status\_code}: {response.text}")  
```

Make sure to replace `‘YOUR_API_KEY’` with your actual HubSpot API key and update the `contact_email` and `subscription_type` variables with the appropriate values from your form submission.

“Hope this will helps you out. Please mark it as **Solution Accepted & Upvote** to help other Community member.  
Thanks!”

---

<div class="post-metadata">

**Author:** ![Nagarjoon](https://avatars.discourse-cdn.com/v4/letter/n/e5b9ba/32.png) [@Nagarjoon](https://community.hubspot.com/u/Nagarjoon)\
**Post date:** [April 19, 2024, 12:57pm UTC](https://community.hubspot.com/t/hubspot-api-forms/84555/3 "2024-04-19T12:57:22Z")

</div>

Hi there! It sounds like you’re looking to store subscription type information through the HubSpot API along with other form data. To achieve this, you’ll need to customize your HubSpot form to include fields for subscription types and then update your API integration to handle these additional fields.

Firstly, within your HubSpot account, navigate to the form editor for your custom form. Add fields for subscription types, such as checkboxes or dropdown menus, allowing users to select their preferences.

Next, ensure that your API integration is configured to capture and handle these subscription type fields. When submitting the form data via the API, include the values from the subscription type fields along with the email and name categories.In your API request, you’ll need to include the subscription type field names and their corresponding values. Make sure that your API request structure aligns with the HubSpot API documentation and that you’re properly formatting the data to be accepted by HubSpot.Once your API integration is updated to include the subscription type information, test your form submission process to verify that all data, including subscription types, is being correctly captured and stored in HubSpot.By following these steps, you should be able to store subscription type information along with other form data using the HubSpot API. If you encounter any issues or need further assistance, don’t hesitate to reach out for help!
