# GraphQL query taking too much time and returning 401 unauthorized

**URL:** <https://community.shiphero.com/t/graphql-query-taking-too-much-time-and-returning-401-unauthorized/2079>\
**Category:** GraphQL API\
**Created:** [July 11, 2022, 11:37am UTC](https://community.shiphero.com/t/graphql-query-taking-too-much-time-and-returning-401-unauthorized/2079 "2022-07-11T11:37:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![saladass4254](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@saladass4254](https://community.shiphero.com/u/saladass4254)\
**Post date:** [July 11, 2022, 11:37am UTC](https://community.shiphero.com/t/graphql-query-taking-too-much-time-and-returning-401-unauthorized/2079/1 "2022-07-11T11:37:23Z")

</div>

Hello,

I am trying to fetch fulfilled orders for the Shiphero accounts that I’m working with and I’ve been having the following issues with them recently:

- Queries that ran almost instantly now take \>50s to complete

- Only for the new account that I’m working with I get the following message: 401, message=‘UNAUTHORIZED’, url=URL(‘[https://public-api.shiphero.com/graphql](https://public-api.shiphero.com/graphql)’)

Any idea why this only happens with the new account, and not the old, and why the query is taking so long. Here is my query:

```auto
query ($current_timestamp:ISODateTime!) {
    orders(fulfillment_status:"fulfilled" order_date_from:$current_timestamp) {
      request_id
      complexity
      data (first:100) {
        pageInfo {
          hasNextPage
          startCursor
          endCursor
        }
        edges {
          cursor
          node {
            id
            order_number
            partner_order_id
            required_ship_date
            shop_name
            fulfillment_status
            order_date
            total_price
            total_discounts
            total_tax
            subtotal
            box_name
            email
            shipping_lines {
              title
              carrier
              method
              price
            }
            shipping_address {
              address1
              address2
              city
              state
              zip
              country
            }
            saturday_delivery
            alcohol
            expected_weight_in_oz
            currency
            has_dry_ice
            shipments {
              shipped_off_shiphero
              shipping_labels {
                tracking_number
                status
                carrier
                shipping_name
                shipping_method
                cost
                delivered
                refunded
                needs_refund
                insurance_amount
                created_date
                dimensions {
                  length
                  width
                  height
                  weight
                }
                address {
                  address1
                  address2
                  city
                  state
                  country
                  zip
                }

              }
            }

          }
        }
      }
      }
      }

```

---

<div class="post-metadata">

**Author:** ![sh-agent](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@sh-agent](https://community.shiphero.com/u/sh-agent)\
**Post date:** [July 11, 2022, 12:18pm UTC](https://community.shiphero.com/t/graphql-query-taking-too-much-time-and-returning-401-unauthorized/2079/2 "2022-07-11T12:18:49Z")

</div>

Hey @saladass4254!

Thanks for reaching out.  
I’m going to look into this and get back to you, but could you provide me with a request id that the query returns in the meantime?

Best,  
RayanP

---

<div class="post-metadata">

**Author:** ![saladass4254](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@saladass4254](https://community.shiphero.com/u/saladass4254)\
**Post date:** [July 11, 2022, 12:51pm UTC](https://community.shiphero.com/t/graphql-query-taking-too-much-time-and-returning-401-unauthorized/2079/3 "2022-07-11T12:51:19Z")

</div>

@sh-agent thanks for getting back! The query is not returning a request ID. When I use a GraphQL client like Altair, I’m getting a 504 error, and when I run it using gql in Python, I’m getting the unauthorized message. I’m happy to share the tokens via DM with you
