# deals endpoints with private api key

**URL:** <https://community.hubspot.com/t/deals-endpoints-with-private-api-key/69841>\
**Category:** APIs & Integrations\
**Tags:** python\
**Created:** [November 23, 2022, 12:10pm UTC](https://community.hubspot.com/t/deals-endpoints-with-private-api-key/69841 "2022-11-23T12:10:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RCarvalho](https://avatars.discourse-cdn.com/v4/letter/r/977dab/32.png) [@RCarvalho](https://community.hubspot.com/u/RCarvalho)\
**Post date:** [November 23, 2022, 12:10pm UTC](https://community.hubspot.com/t/deals-endpoints-with-private-api-key/69841/1 "2022-11-23T12:10:40Z")

</div>

Hello,

I have two questions:

1) I’m trying to get the Deals information/properties by id and I’m using the folowing code in python to return only the dealname and date of creation:

**url** = ‘[https://api.hubapi.com/crm/v3/objects/deal/?limit=100&properties=dealname&](https://api.hubapi.com/crm/v3/objects/deal/?limit=100&properties=dealname&createdate)[properties=](https://api.hubapi.com/crm/v3/objects/deal/?limit=100&properties=dealname&createdate)[createdate](https://api.hubapi.com/crm/v3/objects/deal/?limit=100&properties=dealname&createdate)’

**headers** = {“Authorization”: "Bearer "+ privateApp\_token}

**response** = requests.request(method=‘get’, url = url, headers = headers)

But instead of returning just these two properties, all properties are coming and is taking a lot of time because of that.

2) Using this endpoint I have a limit of 100 records. I have 215 records of deals. How can I get all of them?

---

<div class="post-metadata">

**Author:** ![SSukys](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ssukys/32/35013_2.png) [@SSukys](https://community.hubspot.com/u/SSukys)\
**Post date:** [November 23, 2022, 3:17pm UTC](https://community.hubspot.com/t/deals-endpoints-with-private-api-key/69841/2 "2022-11-23T15:17:24Z")

</div>

Hello @RCarvalho,

Thanks for posting. You need to implement the “after” Query Parameter to use Pagination to get the next 100 Deals.

For example, if we look at this [API Documentation.](https://developers.hubspot.com/docs/api/crm/deals)

The initial result returns the following JSON information. If we look at the “After” parameter we can take that and use it in another query to get the next 100 on the list.

```lia-code-sample
{
 "results": [
 {
 "properties": {
 "amount": "1500.00",
 "closedate": "2019-12-07T16:50:06.678Z",
 "createdate": "2019-10-30T03:30:17.883Z",
 "dealname": "Custom data integrations",
 "dealstage": "presentationscheduled",
 "hs_lastmodifieddate": "2019-12-07T16:50:06.678Z",
 "hubspot_owner_id": "910901",
 "pipeline": "default"
 }
 }
 ],
 "paging": {
 "next": {
 "after": "NTI1Cg%3D%3D",
 "link": "?after=NTI1Cg%3D%3D"
 }
 }
}

```

That new query would look like:

`url = 'https://api.hubapi.com/crm/v3/objects/deal/?limit=100&after=NTI1Cg%3D%3D&properties=dealname&properties=createdate`

We insert the “after” and the pagination key to move the query to start at that record and return the next 100.

I hope you find this helpful!

If you do, make sure to mark my response as a solution!

---

<div class="post-metadata">

**Author:** ![RCarvalho](https://avatars.discourse-cdn.com/v4/letter/r/977dab/32.png) [@RCarvalho](https://community.hubspot.com/u/RCarvalho)\
**Post date:** [November 23, 2022, 4:13pm UTC](https://community.hubspot.com/t/deals-endpoints-with-private-api-key/69841/3 "2022-11-23T16:13:34Z")

</div>

Hi @SSukys,

Thank you for your fast response.

It Works
