How to start with the advanced trade api with node js

Hi,

That’s my first time using the coinbase api and i don’t really know how to start with.

I want to use it with node JS, i also generated my api key on my coinbase account and is ready to use.
For example, i want to buy/sell crypto with my normal coinbase account so i try to use the advanced trading api and i try with the node js code given by the api guide for list accounts but i dont see any place where to add my api key or something to “connect” my account to the api. when i try to run the given code axios give me back an 401 unauthorized error.

i imagine it’s because there is step before just get list of accounts but i don’t find the doc for this first step.

if anyone could help me i would be grateful,

Thanks in advance for answer,

Mwrdev :slight_smile:

Hi @mwrdev! Thank you for taking interest in using the Coinbase APIs and welcome to the Coinbase Cloud Developer’s Forum!

Since you mentioned that you want to buy/sell crypto, we would like to highlight first that the Advanced Trade API lets you manage orders, products, and fees with our new v3 endpoints and it does not duplicate core Coinbase functions for account deposits, withdrawals, and transactions. So instead of using the Advanced Trade API for your use case (buy/sell crypto), we suggest you use the Sign In with Coinbase API - buys/sells endpoints.

For your concern about getting a 401 Unauthorized error response upon calling the List Accounts endpoint, to further help you with your coding concern, we suggest you to open a support ticket with our team with the answers for following details:

  • Upon running the List Accounts endpoint, have you already generated a signature that is needed to authenticate your request? If not, you may check this documentation as a guide for signing a request for the Advanced Trade API. For Sign in with Coinbase API, you may refer here.
  • Can you confirm if nodecoinbase library is the one you are using? If not, please specify.
  • Please provide the code snippet you are using to run the List Accounts endpoint. Kindly ensure to exclude your API credentials for security reasons.
  • Please provide a screenshot to demonstrate the problem you are encountering.

Please use the email address associated with your Coinbase account upon creating a support ticket and kindly include the link of this forum so that the team will be aware that it’s you and be reminded to omit any personal info. Lastly, if you have any additional information/screenshot you would like to add, feel free to do so.

Thank you and have a nice day!