# API Keys related question

**URL:** <https://community.shiphero.com/t/api-keys-related-question/1105>\
**Category:** Getting Started\
**Created:** [February 8, 2021, 11:35am UTC](https://community.shiphero.com/t/api-keys-related-question/1105 "2021-02-08T11:35:51Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhavesh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/bhavesh/32/288_2.png) [@bhavesh](https://community.shiphero.com/u/bhavesh)\
**Post date:** [February 8, 2021, 11:35am UTC](https://community.shiphero.com/t/api-keys-related-question/1105/1 "2021-02-08T11:35:51Z")

</div>

i will integrate in laravel 5.6 ship hero Every time every day API Key chnage?

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [February 9, 2021, 2:05am UTC](https://community.shiphero.com/t/api-keys-related-question/1105/2 "2021-02-09T02:05:22Z")

</div>

Hi @bhavesh  
Welcome to our community!

Are you referring to the token expiration? [Getting Started – Developer Resources | ShipHero](https://developer.shiphero.com/getting-started/#authentication)

Thanks in advance!  
Tom

---

<div class="post-metadata">

**Author:** ![bhavesh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/bhavesh/32/288_2.png) [@bhavesh](https://community.shiphero.com/u/bhavesh)\
**Post date:** [February 11, 2021, 11:36am UTC](https://community.shiphero.com/t/api-keys-related-question/1105/3 "2021-02-11T11:36:26Z")

</div>

i read this document, please guide me on how to implement this API key for web development(PHP)?

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [February 11, 2021, 12:27pm UTC](https://community.shiphero.com/t/api-keys-related-question/1105/4 "2021-02-11T12:27:13Z")

</div>

Hi @bhavesh!  
I’m not familiarized with PHP I apologize for that.

I did found this article on how to Post JSON data with PHP

> <https://stackoverflow.com/questions/11079135/how-to-post-json-data-with-php-curl>

And in case it helps we had another user working with PHP that posted on this thread

> [@How I fetch the products from the shiphero by using the query method](https://community.shiphero.com/t/how-i-fetch-the-products-from-the-shiphero-by-using-the-query-method/818/4):
>
> I don’t know PHP. Sorry.

Thanks again!  
Tom

---

<div class="post-metadata">

**Author:** ![bhavesh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/bhavesh/32/288_2.png) [@bhavesh](https://community.shiphero.com/u/bhavesh)\
**Post date:** [February 17, 2021, 1:13pm UTC](https://community.shiphero.com/t/api-keys-related-question/1105/5 "2021-02-17T13:13:21Z")

</div>

CURLOPT\_USERPWD =\> base64\_encode($username.":".$password),

‘{ “username”: “YOUR EMAIL”,  
“password”: “YOUR PASSWORD”  
}’

which username and password should i required?  
when i run this curl with url i got Response “username is required”  
any Suggestion?

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [February 17, 2021, 1:22pm UTC](https://community.shiphero.com/t/api-keys-related-question/1105/6 "2021-02-17T13:22:07Z")

</div>

Hi @bhavesh!  
You should use the same that when login on [https://app.shiphero.com/dashboard](https://app.shiphero.com/dashboard)

Let me know if that doesn’t work for you,  
Thanks again!  
Tom

---

<div class="post-metadata">

**Author:** ![bhavesh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/bhavesh/32/288_2.png) [@bhavesh](https://community.shiphero.com/u/bhavesh)\
**Post date:** [February 17, 2021, 1:53pm UTC](https://community.shiphero.com/t/api-keys-related-question/1105/7 "2021-02-17T13:53:27Z")

</div>

Yes i am using that but not working.

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [February 17, 2021, 2:03pm UTC](https://community.shiphero.com/t/api-keys-related-question/1105/8 "2021-02-17T14:03:09Z")

</div>

You could test with a test endpoint, something like:

[https://requestbin.com/](https://requestbin.com/)

To verify what is being sent and if it’s as expected

---

<div class="post-metadata">

**Author:** ![bhavesh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/bhavesh/32/288_2.png) [@bhavesh](https://community.shiphero.com/u/bhavesh)\
**Post date:** [February 18, 2021, 1:30pm UTC](https://community.shiphero.com/t/api-keys-related-question/1105/9 "2021-02-18T13:30:26Z")

</div>

$body = ‘mutation {  
order\_create(  
data: {  
order\_number: “11223344”  
shop\_name: “ExampleShop”  
fulfillment\_status: “pending”  
order\_date: “2019-07-29”  
total\_tax: “29.00”  
subtotal: “150.00”  
total\_discounts: “20.00”  
total\_price: “159.00”  
shipping\_lines: {  
title: “UPS”  
price: “0.00”  
carrier: “UPS”  
method: “Ground”  
}  
shipping\_address: {  
first\_name: “John”  
last\_name: “Johnson”  
company: “The Johnson Co”  
address1: “2543 Duck St.”  
address2: “Apt. 2”  
city: “Oklahoma”  
state: “Oklahoma”  
state\_code: “OK”  
zip: “73008”  
country: “US”  
country\_code: “US”  
email: “[johnjohnsonco@johnsonco.com](mailto:johnjohnsonco@johnsonco.com)”  
phone: “5555555555”  
}  
billing\_address: {  
first\_name: “John”  
last\_name: “Johnson”  
company: “The Johnson Co”  
address1: “2543 Duck St.”  
address2: “Apt. 2”  
city: “Oklahoma”  
state: “OK”  
state\_code: “OK”  
zip: “73008”  
country: “US”  
country\_code: “US”  
email: “[johnjohnsonco@johnsonco.com](mailto:johnjohnsonco@johnsonco.com)”  
phone: “5555555555”  
}  
line\_items: {  
sku: “testSKU12345”  
partner\_line\_item\_id: “282960815”  
quantity: 2  
price: “150.00”  
product\_name: “Example Product”  
fulfillment\_status: “pending”  
quantity\_pending\_fulfillment: 2  
warehouse\_id: “V2FyZWhvdYNlOjgwNzU=”  
}  
required\_ship\_date: “2019-08-29”  
}  
)  
}’;

```auto
    $username = 'xxx@lessgistics.com';
	$password = 'xxx456';

	//$credentials = base64_encode("$username:$password");

	$ch = curl_init();
	curl_setopt_array($ch, [
	  CURLOPT_URL=> "https://public-api.shiphero.com/graphql",
	  CURLOPT_RETURNTRANSFER => true,
	  CURLOPT_POST => true,
	  //CURLOPT_USERNAME => "sutharbhavesh1111@gmail.com", //"minipokemart@lessgistics.com", //
	  CURLOPT_POSTFIELDS => $body, // json_encode($order_to_ship), Created same as previous snippet
	  CURLOPT_USERPWD => base64_encode($username.":".$password), //"xxx@lessgistics.com:xxx456",
	  CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
	  CURLOPT_HTTPHEADER => [
	    'Content-Type: application/json',
	    'Accept: application/json',
	    'Cache-Control: no-cache',
	    'Username: sutharbhavesh1111@gmail.com',
	    'refresh_token:',
	    //'Authorization: Basic {$}',
	    'access_token:',
	    'Authorization: Bearer 
	  ],
	  CURLOPT_SSL_VERIFYPEER => true,
	  CURLOPT_SSL_VERIFYHOST => 0,
	]);

	
	$response = curl_exec($ch);
	//echo "<pre>";
	//print_r($response);
	var_dump($response);

	exit;

```

**string(71) “{“message”: “Unexpected error. Please contact a system administrator.”}”**

I get in this error now please any one can help me i am stuck in this code since last one week

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [February 18, 2021, 1:36pm UTC](https://community.shiphero.com/t/api-keys-related-question/1105/10 "2021-02-18T13:36:52Z")

</div>

Hi @bhavesh!  
Could you share the `request_id` returned for that mutation?  
If you try [using an IDE such as Altair](https://developer.shiphero.com/getting-started/#schemaanddocs), does it work with that same payload?  
Thanks in advance!  
Tom

---

<div class="post-metadata">

**Author:** ![bhavesh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/bhavesh/32/288_2.png) [@bhavesh](https://community.shiphero.com/u/bhavesh)\
**Post date:** [February 18, 2021, 2:04pm UTC](https://community.shiphero.com/t/api-keys-related-question/1105/11 "2021-02-18T14:04:58Z")

</div>

![s_1](https://us1.discourse-cdn.com/flex020/uploads/shiphero/original/1X/0a3e5ed3423d5acc5d46007403b577168bc7e7db.png) ![S_2](https://us1.discourse-cdn.com/flex020/uploads/shiphero/original/1X/478228579faaeb3121a031e3ddd44c4295b4cc63.png)

Bearer code is not working i think all perfect stepby step follow but not working  
“error”: “Failed to fetch schema. Please check your connection”

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [February 18, 2021, 2:11pm UTC](https://community.shiphero.com/t/api-keys-related-question/1105/12 "2021-02-18T14:11:47Z")

</div>

Try adding the account query, something like this:

```
query {
  account {
    request_id
    complexity
    data {
      id
      legacy_id
    }
  }
}

```

And seeing if it returns something

---

<div class="post-metadata">

**Author:** ![bhavesh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/bhavesh/32/288_2.png) [@bhavesh](https://community.shiphero.com/u/bhavesh)\
**Post date:** [February 18, 2021, 2:13pm UTC](https://community.shiphero.com/t/api-keys-related-question/1105/13 "2021-02-18T14:13:59Z")

</div>

same error display

“error”: “Failed to fetch. Please check your connection”

Connection error

---

<div class="post-metadata">

**Author:** ![bhavesh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/bhavesh/32/288_2.png) [@bhavesh](https://community.shiphero.com/u/bhavesh)\
**Post date:** [February 19, 2021, 9:53am UTC](https://community.shiphero.com/t/api-keys-related-question/1105/14 "2021-02-19T09:53:27Z")

</div>

How to get Warehouse id from query?

---

<div class="post-metadata">

**Author:** ![Theresa](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/theresa/32/377_2.png) [@Theresa](https://community.shiphero.com/u/Theresa)\
**Post date:** [February 19, 2021, 3:12pm UTC](https://community.shiphero.com/t/api-keys-related-question/1105/15 "2021-02-19T15:12:56Z")

</div>

Hello!  
This is the query you would use to get the warehouse id:

```
query{
  account{
    data{
      warehouses{
        id
      }
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![bhavesh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/bhavesh/32/288_2.png) [@bhavesh](https://community.shiphero.com/u/bhavesh)\
**Post date:** [February 20, 2021, 5:29am UTC](https://community.shiphero.com/t/api-keys-related-question/1105/16 "2021-02-20T05:29:12Z")

</div>

hello @tomasw @Theresa  
Thank You for replay i have tested and there is working on “Altair GraphQLClient” Than after run this code on my file give me this Respons.  
“message”: “Unexpected error. Please contact a system administrator.”}  
Thanks in advance!  
Bhavesh

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [February 22, 2021, 1:10pm UTC](https://community.shiphero.com/t/api-keys-related-question/1105/17 "2021-02-22T13:10:26Z")

</div>

Hi @bhavesh!  
If you send both to Request Bin (Altair and your code) can you spot any difference between both?  
Thanks again!  
Tom

---

<div class="post-metadata">

**Author:** ![bhavesh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/bhavesh/32/288_2.png) [@bhavesh](https://community.shiphero.com/u/bhavesh)\
**Post date:** [February 23, 2021, 5:56am UTC](https://community.shiphero.com/t/api-keys-related-question/1105/18 "2021-02-23T05:56:45Z")

</div>

Hello @tomasw  
No changes difference between both code  
Thanks again!  
Bhavesh

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [February 23, 2021, 12:46pm UTC](https://community.shiphero.com/t/api-keys-related-question/1105/19 "2021-02-23T12:46:35Z")

</div>

Thanks for confirming that @bhavesh!  
Are you on a fulfillment account?  
If that is the case it won’t work because those accounts don’t have warehouses, but you could try getting your warehouse ID from the following Query:

```
query{
  account{
    request_id
    complexity
    data{
          id
    legacy_id
    my_warehouse {
      id
    }
    }
  }
}

```

Is there any chance you could send us a `request_id` for when you try this on Altair and sends you the correct response back?  
That way we can get your account details and investigate further.  
Thanks again!  
Tom

---

<div class="post-metadata">

**Author:** ![bhavesh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/bhavesh/32/288_2.png) [@bhavesh](https://community.shiphero.com/u/bhavesh)\
**Post date:** [February 24, 2021, 12:28pm UTC](https://community.shiphero.com/t/api-keys-related-question/1105/20 "2021-02-24T12:28:08Z")

</div>

Thanks for guide to me @tomasw  
order is working fine but i not find out this same question.

1. How to get tracking number from order because i send a email in put this tracking number.
2. Order date i will put but he automatically add yesterday date.  
please give me suggestion

Thanks again!  
Bhavesh

[Next page](https://community.shiphero.com/t/api-keys-related-question/1105.md?page=2)
