# HubDB API - Add Row With Foreign Key

**URL:** <https://community.hubspot.com/t/hubdb-api-add-row-with-foreign-key/30056>\
**Category:** APIs & Integrations\
**Tags:** cms-content, developer-tools\
**Created:** [January 12, 2021, 12:46pm UTC](https://community.hubspot.com/t/hubdb-api-add-row-with-foreign-key/30056 "2021-01-12T12:46:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SirHubalot](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sirhubalot/32/13631_2.png) [@SirHubalot](https://community.hubspot.com/u/SirHubalot)\
**Post date:** [January 12, 2021, 12:46pm UTC](https://community.hubspot.com/t/hubdb-api-add-row-with-foreign-key/30056/1 "2021-01-12T12:46:49Z")

</div>

Hi,

I have been working quite alot in implementing Hubspots API in sending data to my HubDB tables. I have come across an issue where one of my table fields is a Foreign Key.

I can’t find anywhere in the documentation what the value type is for the response when sending it to the API. The Create row endpoint list all field types minus a Foreign key: [https://legacydocs.hubspot.com/docs/methods/hubdb/v2/create\_row](https://legacydocs.hubspot.com/docs/methods/hubdb/v2/create_row)

Is this something the API cannot do? If it can, I would be grateful for an example.

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [January 12, 2021, 7:15pm UTC](https://community.hubspot.com/t/hubdb-api-add-row-with-foreign-key/30056/2 "2021-01-12T19:15:26Z")

</div>

Hello @SirHubalot

I believe the [question](https://community.hubspot.com/t5/APIs-Integrations/Adding-Video-Child-Table-and-Foreign-ID-s-to-API-Created-HubDB/m-p/356531) @DavidFJones asked is what you are also asking. @WendyGoh provided an answer.

---

<div class="post-metadata">

**Author:** ![SirHubalot](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sirhubalot/32/13631_2.png) [@SirHubalot](https://community.hubspot.com/u/SirHubalot)\
**Post date:** [January 18, 2021, 6:03pm UTC](https://community.hubspot.com/t/hubdb-api-add-row-with-foreign-key/30056/3 "2021-01-18T18:03:49Z")

</div>

Hi dennisedson.

That was one of the first posts I saw but that didn’t help me. But I managed to find the solution. All I needed to do was to send over my foreign keys to my table column in the following JSON Structure:

```lia-code-sample
[
 {
	id: 123456789,
	type: "foreignid"
 },
 {
	id: 988765434,
	type: "foreignid"
 },
 {
	id: 4645645644,
	type: "foreignid"
 }
]

```

---

<div class="post-metadata">

**Author:** ![skylightipv](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@skylightipv](https://community.hubspot.com/u/skylightipv)\
**Post date:** [July 20, 2023, 9:13am UTC](https://community.hubspot.com/t/hubdb-api-add-row-with-foreign-key/30056/4 "2023-07-20T09:13:10Z")

</div>

I’d be interested to know if you had the same issue as I have when inserting a foreign id via API

[https://community.hubspot.com/t5/APIs-Integrations/HUBDB-foreign-ID-insertion-via-API-doesn-t-work/m-p/816774#M65489](https://community.hubspot.com/t5/APIs-Integrations/HUBDB-foreign-ID-insertion-via-API-doesn-t-work/m-p/816774#M65489)
