403 Forbidden - Daily quota reached or API key unauthorized


#1

I am using the free version and the message always appears
403 ({‘error’: ‘Daily quota reached or API key unauthorized’})

that could be happening?

Thank you!
Regards,
Juan


#2

Exactly what it says, I guess. Either your API key is not valid or you reached the daily quota.

An example query would surely help.


#3

the key api is correct, and I have not reached the daily quota, this is my code

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

namespace Ruta
{
class Program
{
static async Task Main(string[] args)
{

        var baseAddress = new Uri("https://api.openrouteservice.org");

        using (var httpClient = new HttpClient { BaseAddress = baseAddress })
        {

            httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8");
            httpClient.DefaultRequestHeaders.Authorization =
                new AuthenticationHeaderValue("Authorization","5b3ce3597851110001cf6248985eba971d6a432982352355657a5ded");

            using (var content = new StringContent("{locations:[[9.70093,48.477473],[9.207916,49.153868],[37.573242,55.801281],[115.663757,38.106467]]}"))
            {
                using (var response = await httpClient.PostAsync("/v2/matrix/driving-car", content))
                {
                    string responseData = await response.Content.ReadAsStringAsync();
                }
            }
        }

    }
}

}


#4

Ok, your key is valid, yep (not a good idea to make that public btw…).

Can you print the full URL, passed parameters and headers? It needs Content-Type: application/json and well, the POST request actually has to post a JSON object (not sure if your lib does that automatically from that string you pass). That shouldn’t result in this API error, but the rest actually looks fine to me.


#5

I removed that code from the Open Route page,
this is what returns me:

|response|{StatusCode: 403, ReasonPhrase: ‘Forbidden’, Version: 1.1, Content: System.Net.Http.StreamContent, Headers: { Connection: keep-alive Date: Wed, 08 May 2019 15:56:15 GMT Server: nginx/1.10.3 Server: (Ubuntu) Content-Length: 61 Content-Type: application/json }}|System.Net.Http.HttpResponseMessage|


#6

We can’t help if you don’t give us one full exact HTTP request that fails: full URL, POST parameters and headers. Please print them in your debug window and paste them here (minus the Authorization header pls).


#7


#8

Paste. Please. This is not a nice way to request free support… And READ!! Your content-type is text/plain! If you use our POST endpoint, you have to POST a JSON, not a string! That’s what I was telling you here:

Can you print the full URL, passed parameters and headers? It needs Content-Type: application/json and well, the POST request actually has to post a JSON object (not sure if your lib does that automatically from that string you pass). That shouldn’t result in this API error, but the rest actually looks fine to me.