{"message":"Invalid Product Type","errorcode":"AB1012","status":false,"data":null}


  • Dear Team

    We are getting the below error while placing an order.

    {"message":"Invalid Product Type","errorcode":"AB1012","status":false,"data":null}

    API Request: {"variety":"NORMAL","tradingsymbol":"FINNIFTY14MAR2317650CE","symboltoken":"52205","transactiontype":"BUY","exchange":"NFO","ordertype":"MARKET","producttype":"DELIVERY","duration":"DAY","price":0.0,"squareoff":0.0,"stoploss":0.0,"quantity":40}


  • @admin
    The full request code and request payload are are added here for further details

    The app is a wpf app.

    public async Task<bool> PlaceEntryOrder(TradingAccount tradingAccount, Position position)
    {
    
        bool result = false;
        string uri = "https://apiconnect.angelone.in/rest/secure/angelbroking/order/v1/placeOrder";
        //string uri = $"https://webhook.site/a6ac03d9-a9bc-4665-9dae-56cc1f2b5c24";
        try
        {
            if (tradingAccount?.IsLoggedIn == true)
            {
                HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, uri);
                httpRequestMessage.Headers.Add("Authorization", "Bearer " + tradingAccount?.JwtToken);
                httpRequestMessage.Headers.Add("Accept", "application/json");
                httpRequestMessage.Headers.Add("X-UserType", "USER");
                httpRequestMessage.Headers.Add("X-SourceID", "WEB");
                httpRequestMessage.Headers.Add("X-ClientLocalIP", "");
                httpRequestMessage.Headers.Add("X-ClientPublicIP", "");
                httpRequestMessage.Headers.Add("X-MACAddress", "");
                httpRequestMessage.Headers.Add("X-PrivateKey", tradingAccount?.ApiKey);
    
                OrderPlaceRequest request = new OrderPlaceRequest();
                request.TradingSymbol = position.TradingSymbol;
                request.SymbolToken = position.Token;
                request.Exchange = position.Exchange.ToString();
                request.OrderType = position.OrderType.ToString();
                request.ProductType = position.ProductType.ToString();
                if (position.TradeSide == Enums.TradeSides.Buy)
                {
                    request.TransactionType = "BUY";
                }
                else
                {
                    request.TransactionType = "SELL";
                }
                request.Price = position.EntryPrice.ToString("N2");
                request.Quantity = position.EntryQty.ToString("N0");
    
                httpRequestMessage.Content = JsonContent.Create(request);
    
                HttpClient httpClient = _httpClientFactory.CreateClient();
                httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage httpResponseMessage = await httpClient.SendAsync(httpRequestMessage);
                if (httpResponseMessage.IsSuccessStatusCode)
                {
                    string response = await httpResponseMessage.Content.ReadAsStringAsync();
                    if (response.Contains("SUCCESS"))
                    {
                        OrderPlaceResponse? orderPlaceResponse = await httpResponseMessage.Content.ReadFromJsonAsync<OrderPlaceResponse>();
                        if (orderPlaceResponse != null)
                        {
                            if (orderPlaceResponse.Status == true && orderPlaceResponse.Data != null && orderPlaceResponse.Data.Script == position.TradingSymbol)
                            {
                                position.EntryStatus = Enums.TradeStatus.Open;
                                position.EntryOrderId = orderPlaceResponse.Data.OrderId;
                                position.EntryUniqueOrderId = orderPlaceResponse.Data.UniqueOrderId;
                                result = true;
                            }
                        }
                    }
                    else
                    {
                        ErrorResponse? errorResponse = await httpResponseMessage.Content.ReadFromJsonAsync<ErrorResponse>();
                        if (errorResponse != null)
                        {
                            position.EntryStatus = Enums.TradeStatus.Failed;
                            _loggerService.Error(errorResponse.Message);
                        }
                    }
                }
                else
                {
                    position.EntryStatus = Enums.TradeStatus.Failed;
                    _loggerService.Error("Request failed. Check network connection");
                }
            }
        }
        catch (Exception ex)
        {
            Trace.WriteLine("Login Error : " + ex.ToString());
        }
    
        return result;
    
    }
    

    And the request captured in webhook.site is given below for more details

    {
      "variety": "NORMAL",
      "tradingSymbol": "NIFTY27FEB2523150CE",
      "symbolToken": "55645",
      "transactionType": "BUY",
      "exchange": "NFO",
      "orderType": "LIMIT",
      "productType": "INTRADAY",
      "duration": "DAY",
      "price": "27.50",
      "squareoff": "0",
      "stoploss": "0",
      "quantity": "75",
      "triggerPrice": "0",
      "trailingStopLoss": "0",
      "disclosedQuantity": "0",
      "orderTag": ""
    }
    

    Screenshot 2025-02-21 210124.png


  • @admin The api parameters given below

    {
      "variety": "NORMAL",
      "tradingSymbol": "NIFTY27FEB2523150CE",
      "symbolToken": "55645",
      "transactionType": "BUY",
      "exchange": "NFO",
      "orderType": "LIMIT",
      "productType": "INTRADAY",
      "duration": "DAY",
      "price": "27.50",
      "squareoff": "0",
      "stoploss": "0",
      "quantity": "75",
      "triggerPrice": "0",
      "trailingStopLoss": "0",
      "disclosedQuantity": "0",
      "orderTag": ""
    }
    

  • @Ranjicgnr send your API request with parameters.


  • I am also getting the same error for NIFTY options. I tried MARGIN, INTRADAY, CARRYFORWARD, MIS. But still it gives same error.

  • topic:timeago_earlier,2 years

  • Hi @PareshBhatiya

    Try using producttype as CARRYFORWARD instead of DELIVERY, that should work.

6 out of 6