Getting 'invalid_product_id' error with orders endpoint in advanced trade

With the advanced trade api, I’m getting an error with these parameters with the endpoint /api/v3/brokerage/orders:

uuid = str(uuid.uuid1())
{'client_order_id': uuid, 'product_id': 'BTC-USD', 'side': 'BUY', 'order_configuration': {'market_market_ioc': {'quote_size': 0.0001}}}

This is the result I’m getting:

{'error': 'INVALID_ARGUMENT', 'error_details': 'Invalid product_id', 'message': 'Invalid product_id'}

I checked my api permissions and both create orders and read wallets are checked per this, and I tried different product ids and still got the same response. I’m stumped.

1 Like

Hello @limitedabilities! Welcome to the forum community.

We understand that you get 'error' : 'INVALID_ARGUMENT' with the Create Order endpoint of Advance Trade API. However, we recommend you to change the value of data field quote_size as the "quote_min_size" for the product_id BTC-USD is "1".

You may check the min and max quote_size for all the product_ids using the List Products endpoint and for any specific product by Get Product endpoint.

We hope this helps. Please let us know if you still face the issue.

Thank you, and have a great day ahead!

Hi - thanks for your response. I updated the quote_size to 1 and tried a few other pairs - and I’m still getting the same error.

Hello @limitedabilities! Thank you for your reply.

To further help you with your concern, we suggest you to open a support ticket with our team with the following details:

  • Please provide the code snippet of your request body.
  • Please provide a screenshot of the error code that you are experiencing in the response/result.
  • If you have any more information or screenshot that can demonstrate your concern, feel free to share it with us. Please ensure to send any images or screenshots as attachments, as we’re unable to see images/screenshots when they are inserted in the body of your email and be reminded to omit any personal info.

Upon creating a support ticket, kindly include the link of this forum so that the team will be aware that it’s you. Additionally, please use the email address associated with your Coinbase account.

Thank you!

Here is the code snippet for the request:

def authenticate(method, endpoint):
    timestamp = str(int(time.time()))
	key = os.environ.get("COINBASE_KEY")
    secret = os.environ.get("COINBASE_SECRET")
    message = timestamp + method + endpoint
    
    signature = hmac.new(
        secret.encode('utf-8'), 
        message.encode('utf-8'), 
        digestmod=hashlib.sha256
    ).digest().hex()
    headers = {
        'CB-ACCESS-SIGN': signature,
        'CB-ACCESS-TIMESTAMP': timestamp,
        'CB-ACCESS-KEY': key,
        'Content-Type': 'application/json'
    }
    return headers

method = "POST"
url = "https://api.coinbase.com"
endpoint = f"/api/v3/brokerage/orders"

params = {
  'client_order_id': str(uuid.uuid1()),
  'product_id': 'BTC-USD',
  'side': 'BUY',
  'order_configuration': {'market_market_ioc': {'quote_size': 1}}
}
auth = authenticate(method=method, endpoint=endpoint)

response = requests.request(
  method=method, 
  url=url+endpoint, 
  params=params, 
  headers=auth
)

Hello @limitedabilities ! Thank you for sharing the code snippet. However, to further investigate your concern, we would request you to open a support ticket with our team capturing all the required details.

Also as mentioned earlier, upon creating a support ticket, include the link of this forum so that the team will be aware that it’s you.