# API email with dynamic fields

**URL:** <https://community.hubspot.com/t/api-email-with-dynamic-fields/106964>\
**Category:** APIs & Integrations\
**Tags:** php, email\
**Created:** [May 12, 2024, 6:38am UTC](https://community.hubspot.com/t/api-email-with-dynamic-fields/106964 "2024-05-12T06:38:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Music](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Music](https://community.hubspot.com/u/Music)\
**Post date:** [May 12, 2024, 6:38am UTC](https://community.hubspot.com/t/api-email-with-dynamic-fields/106964/1 "2024-05-12T06:38:56Z")

</div>

Hi,

I am a developer, I want to send an email using PHP that the template of the email is inside Hubspot with dynamic fields.  
For example, the start of the email is:  
Hi {name},  
I want to change the {name} from the PHP code.

How can I achive it?

---

<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:** [May 13, 2024, 1:57pm UTC](https://community.hubspot.com/t/api-email-with-dynamic-fields/106964/2 "2024-05-13T13:57:37Z")

</div>

Hi @Music

I have share a curl hope this could help you resolve your query and a link for your reference.

> **[Accounts Dashboard | HubSpot](https://app.hubspot.com/myaccounts?next=developerdocs&redirect=%2Fapi-reference%2Fmarketing-single-send-v4%2Fguide)**

```lia-code-sample
curl --request POST \
 --url https://api.hubapi.com/marketing/v4/email/single-send \
 --header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
 --header 'content-type: application/json' \
 --data '{
 "emailId": 0,
 "message": {
 "cc": [
 "string"
 ],
 "sendId": "string",
 "bcc": [
 "string"
 ],
 "replyTo": [
 "string"
 ],
 "from": "string",
 "to": "string"
 },
 "contactProperties": {
 "firstname": "XYZ",
 "lastname": "Hello",
 "email": "test@example.com"
 }
}'

```

I hope this will help you out. Please mark it as **Solution Accepted and upvote** to help another Community member.  
Thanks!
