# Not able to get more than 100 historical orders using activities endpoint

**URL:** <https://forum.alpaca.markets/t/not-able-to-get-more-than-100-historical-orders-using-activities-endpoint/13652>\
**Category:** Alpaca Integration Applications\
**Created:** [February 11, 2024, 4:30pm UTC](https://forum.alpaca.markets/t/not-able-to-get-more-than-100-historical-orders-using-activities-endpoint/13652 "2024-02-11T16:30:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CuCrest](https://avatars.discourse-cdn.com/v4/letter/c/a6a055/32.png) [@CuCrest](https://forum.alpaca.markets/u/CuCrest)\
**Post date:** [February 11, 2024, 4:30pm UTC](https://forum.alpaca.markets/t/not-able-to-get-more-than-100-historical-orders-using-activities-endpoint/13652/1 "2024-02-11T16:30:01Z")

</div>

Hi,

I’m trying to get the account order history (FILL) using the /v2/account/activities/activity\_type/ endpoint but I’m not able to get the pagination to work as the result only provides a list of 100 transactions.

Instead of API key/secret, I’m using access token in the header.

This is what I’m following:

> **[Get Account Activities of One Type](https://docs.alpaca.markets/reference/getaccountactivitiesbyactivitytype)**
>
> Returns account activity entries for a specific type of activity.

I’m using python and using the URL: **api.alpaca.markets/v2/account/activities/activity\_type/FILL** gives me a 404 (but this is the URL in the documentation).

However, using the URL **api.alpaca.markets/v2/account/activities?activity\_types=FILL** works  
but only gives me a list of 100 most recent orders with no way to paginate.

I’m a bit confused. Am I using the wrong documentation? How can I get more historical trades or paginate historical account fills?

---

<div class="post-metadata">

**Author:** ![Dan\_Whitnable\_Alpaca](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/dan_whitnable_alpaca/32/1658_2.png) [@Dan\_Whitnable\_Alpaca](https://forum.alpaca.markets/u/Dan_Whitnable_Alpaca)\
**Post date:** [February 12, 2024, 4:15pm UTC](https://forum.alpaca.markets/t/not-able-to-get-more-than-100-historical-orders-using-activities-endpoint/13652/2 "2024-02-12T16:15:36Z")

</div>

@CuCrest The activities can be paged using the ID of the last activity returned. If there are no activities returned after subsequent paging then that is the end. There is an explanation in the docs [here](https://docs.alpaca.markets/reference/getaccountactivities)

As an example, the first request would be without a page\_token

> [https://paper-api.alpaca.markets/v2/account/activities/FILL?after=2024-01-01%2000%3A00%3A00&page\_size=2](https://paper-api.alpaca.markets/v2/account/activities/FILL?after=2024-01-01%2000%3A00%3A00&page_size=2)

The result is this (notice there are 2 records since page\_size=2 was specified)

> ```auto
> [
> {
> "id": "20240112131913030::26001117-479d-4323-8a4a-eddcebe92ffd",
> "activity_type": "FILL",
> "transaction_time": "2024-01-12T18:19:13.030355Z",
> "type": "partial_fill",
> "price": "235.07",
> "qty": "1.534308929",
> "side": "buy",
> "symbol": "FNGU",
> "leaves_qty": "4",
> "order_id": "80557fa3-51a6-4411-b9d4-5b397d7fca2b",
> "cum_qty": "38.534308929",
> "order_status": "partially_filled"
> },
> {
> "id": "20240112131913027::64f18004-bcd7-4dca-8efb-6454597ac3fb",
> "activity_type": "FILL",
> "transaction_time": "2024-01-12T18:19:13.027857Z",
> "type": "fill",
> "price": "235.07",
> "qty": "4",
> "side": "buy",
> "symbol": "FNGU",
> "leaves_qty": "0",
> "order_id": "80557fa3-51a6-4411-b9d4-5b397d7fca2b",
> "cum_qty": "42.534308929",
> "order_status": "filled"
> }
> ]
> 
> ```

The next call would be identical to the original call but with the added parameter `page_token=20240112131913027::64f18004-bcd7-4dca-8efb-6454597ac3fb`

> `https://paper-api.alpaca.markets/v2/account/activities/FILL?after=2024-01-01%2000%3A00%3A00&page_size=2&page_token=20240112131913027::64f18004-bcd7-4dca-8efb-6454597ac3fb`

That will then return the next page of results. The `page_size` can be set to anything 1-100.

---

<div class="post-metadata">

**Author:** ![CuCrest](https://avatars.discourse-cdn.com/v4/letter/c/a6a055/32.png) [@CuCrest](https://forum.alpaca.markets/u/CuCrest)\
**Post date:** [February 12, 2024, 7:32pm UTC](https://forum.alpaca.markets/t/not-able-to-get-more-than-100-historical-orders-using-activities-endpoint/13652/3 "2024-02-12T19:32:25Z")

</div>

Thank you! That helped!
