c# – Amazon SP-API Feed


I am trying to send a shipping confirmation to Amazon, for this the Feeds API is used. There is a guide for this on GitHub. Here

The problem is that I stay in step 1. In this step I have to invoke the API passing it a parameter, specifically contentType , in addition to the authentication headers.

I have searched many places, but without success, I always get "invalid input".

Attached response code:

  "errors": [
      "code": "InvalidInput",
      "message": "Invalid Input",
      "details": ""

Also, I attach parameters that I pass to the request

 [0]: {x-amz-access-token=Atza|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
 [1]: {contentType=text/tab-separated-values;charset=UTF-8}
 [2]: {X-Amz-Date=20210610T124106Z}
 [3]: {host=sellingpartnerapi-eu.amazon.com}
 [4]: {Authorization=AWS4-HMAC-SHA256 Credential=xxxxxxxxx/20210610/eu-west-1/execute-api/aws4_request, SignedHeaders=host;x-amz-access-token;x-amz-date, Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
 [5]: {Content-type=application/json}
 [6]: {user-agent=My App 1.0 (Language=csharp;Platform=Windows/10)}

Obviously the sensitive data is not there.

It is not an authentication problem.

It is developed in C #.

Code for the API call


        string urlApi = "/feeds/2020-09-04/documents";
        restClient = new RestClient(urlApi);
        IRestRequest restRequest = new RestRequest(urlApi, Method.POST);

        restRequest.AddHeader("x-amz-access-token", txtAccessToken.Text);
        //Creo que esto es correcto, pero tampoco estoy seguro... Tampoco veo mucha información al respecto.
        restRequest.AddParameter("contentType", "text/tab-separated-values; charset=UTF-8", ParameterType.RequestBody);
        var request = signatureHelper.SignRequest(restRequest, restClient, content_form_urlencoded);

            var result = restClient.Execute(request); //cuando ejecuta me devuelve el "invalid"

So, now my question is: what am I doing wrong? I think I am doing everything that the guide indicates.

Attempts made:

Parameter p = new Parameter(
               "text/tab-separated-values; charset=UTF-8",


Attempt made

restRequest.AddJsonBody(new { contentType = "text/xml; charset=UTF-8" });


Another unsuccessful attempt, launch the request with JSON type.

var request = signatureHelper.SignRequest(restRequest, restClient, "application/json");

unsuccessfully. Invalid input.

Additionally it has been tested adding the accept: */* parameter. Seen on an Amazon forum


Finally the issue is solved, the problem, for those who are interested in the future, was the Amazon API itself and together with its precarious documentation they gave rise to this error.

It was not necessary to touch code, nothing. Simply Amazon, through a case (a ticket or request from a user, in this case myself), solved, saying that in effect the API was wrong and they went on to fix it.

The truth is that knowing this surprises me, but I have learned that no matter how big the company is, there are always mistakes.

For future reference, the question code is ok, usable, and functional.

Scroll to Top