How to Get Coinbase API to Authenticate and Buy Bitcoin


I’ve got a problem which I’ve detailed in this stackoverflow post here:

The main issue right now is that I can’t seem to access the ‘time endpoint’ here: because that page doesn’t work!

My code is compalining that the timestamp is incorrect.

Any ideas??

Hi @xccelerated99, thank you for taking an interest in trying out Coinbase APIs. For the details regarding your inquiry, we will check on this for you with our team to see how we can best assist. We will get back to you once we have more information. Keep in touch!

Hi @xccelerated99, first of all, we’d like to thank you for taking an interest in trying out the Coinbase APIs.

Now, before getting started with addressing your concerns, we’d like to clear some things out. Sign in with Coinbase and Coinbase Exchange/Pro are different services. They have different API counterparts. This means their API endpoints are different as well.

If you’d like to know more about their differences, you may choose to visit our documentation at

Now that that is out of the way, we noticed that you have a mixture of codes that are trying to do two separate things at once.

(1) From the majority of the code, we can see that you are trying to push a POST request on the /orders endpoint. This endpoint belongs to the Coinbase Exchange/Pro API. And so, if this is what you are trying to do, you would need to update the URL to the appropriate one. Since you are trying to call the Coinbase Exchange/Pro endpoint, you would need to change it to

(2) However, from the URL, it would imply that you are trying to push a GET request to the SIWC endpoint /accounts. If this is the case, the rest of the code has to change especially if you are trying to push a GET request to the said endpoint.

Finally, regarding timestamps, we noticed that you don’t have the Math.floor() function on the timestamp part of your code. You may check the sample code in our documentation here.

Additionally, you may query the time endpoint of SIWC (here) and compare the timestamp you are getting from your code.

Should you need further clarifications or queries about Coinbase Cloud APIs, feel free to reply to this thread.


Hey! Thank you so much for this articulate and solution-oriented answer.

AJ :sunglasses: :money_mouth_face:


Ok, I’ve gotten the time from the time endpoint successfully but now I’m getting an error which says “{ id: ‘invalid_token’, message: ‘The access token is invalid’ }”. This is after I perform a GET call to the ‘’ API. What would you advise?

Hello @xccelerated99, we are so glad you are moving forward from your initial standpoint. We noticed that your stackoverflow post is already removed, and so, we would appreciate it if you can provide us the most recent code you have. You may post in this thread. Upon doing so, we will quickly work on figuring out how we can help you.