# API migration V3

**URL:** <https://community.hubspot.com/t/api-migration-v3/79908>\
**Category:** APIs & Integrations\
**Tags:** free\
**Created:** [April 24, 2023, 9:47am UTC](https://community.hubspot.com/t/api-migration-v3/79908 "2023-04-24T09:47:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mm87](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mm87/32/30191_2.png) [@Mm87](https://community.hubspot.com/u/Mm87)\
**Post date:** [April 24, 2023, 9:47am UTC](https://community.hubspot.com/t/api-migration-v3/79908/1 "2023-04-24T09:47:22Z")

</div>

Hi, I need to migrate Hubdb v1 to v3.

Below is the v1 code, can some one help me upgrade to v3 please.

**import requests**

**url = ‘[https://api.hubapi.com/hubdb/api/v1/tables/](https://api.hubapi.com/hubdb/api/v1/tables/)’**  
**#apikey = ‘NOPE’**  
**headers = {**  
**‘Authorization’: ‘Bearer pat-na1-NOPE’**  
**}**  
**table\_id = ‘5090722’**  
**#post\_url = url + table\_id + ‘/import?hapikey=’ + apikey**  
**post\_url = url + table\_id + ‘/import’**

**import\_config = ‘{“resetTable”:true,“skipRows”:0,“format”:“csv”,’\**  
**‘“nameSourceColumn”:15,“pathSourceColumn”:40,“columnMappings”:[{“source”:15,“target”:23},’ \**  
**‘{“source”:9,“target”:3},{“source”:3,“target”:40},{“source”:18,“target”:5},’ \**  
**‘{“source”:19,“target”:6},’ \**  
**‘{“source”:17,“target”:7},{“source”:35,“target”:12},{“source”:32,“target”:9},{“source”:36,’ \**  
**‘“target”:20}, {“source”:33,“target”:10},{“source”:34,“target”:11},’ \**  
**‘{“source”:23,“target”:13},{“source”:16,“target”:14},’ \**  
**‘{“source”:6,“target”:16},{“source”:5,“target”:17},{“source”:38,“target”:19},’ \**  
**‘{“source”:31,“target”:41},{“source”:37,“target”:42},{“source”:8,“target”:36},’ \**  
**‘{“source”:9,“target”:37},{“source”:10,“target”:38},{“source”:11,“target”:39},’ \**  
**‘{“source”:2,“target”:40},{“source”:12,“target”:43},{“source”:20,“target”:44},’ \**  
**‘{“source”:13,“target”:45},{“source”:21,“target”:46},{“source”:22,“target”:47},’ \**  
**‘{“source”:25,“target”:48},{“source”:26,“target”:49},{“source”:26,“target”:50},’ \**  
**‘{“source”:28,“target”:51},{“source”:41,“target”:54},{“source”:4,“target”:55},{“source”:3,“target”:4},{“source”:24,“target”:52},{“source”:14,“target”:18},’ \**  
**‘{“source”:39,“target”:2}]}’**

**files = {**  
**‘config’: (None, import\_config, ‘application/json’),**  
**‘file’: (None, open(‘data.csv’, ‘rb’), ‘text/csv’)**  
**}**

**#r = requests.post(post\_url, files=files)**  
**r = requests.post(post\_url, files=files,headers=headers)**

**print(r)**  
**print(r.content)**

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [April 24, 2023, 6:57pm UTC](https://community.hubspot.com/t/api-migration-v3/79908/2 "2023-04-24T18:57:02Z")

</div>

Hey, @Mm87 👋 Thanks for your post. Please be careful to never share your authentication tokens. I’ve removed them from this post. And you should cycle them out ASAP.

To your request, can you clarify which specific endpoint you are using? [CMS API | HubDB](https://developers.hubspot.com/docs/api/cms/hubdb)

For example, is it either of?

- **GET** `/cms/v3/hubdb/tables`
- **POST** `/cms/v3/hubdb/tables`

Thank you! — Jaycee

---

<div class="post-metadata">

**Author:** ![Mm87](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mm87/32/30191_2.png) [@Mm87](https://community.hubspot.com/u/Mm87)\
**Post date:** [April 25, 2023, 5:16am UTC](https://community.hubspot.com/t/api-migration-v3/79908/3 "2023-04-25T05:16:44Z")

</div>

Hi [@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074) , thanks for your message. I’m using Post method.
