403 returned while trying to post metrics to New Relic

Hello,

I ran the below curl command and am facing 403 error. Please note that i am using the right API Key in the headers and still getting 403 Error.

curl -vvv -k -H "Content-Type: application/json" \
-H "Api-Key: YOUR_API_KEY_HERE" \
-X POST https://metric-api.newrelic.com/metric/v1 \
--data '[{ 
        "metrics":[{ 
           "name":"memory.heap", 
           "type":"gauge", 
           "value":2.3, 
           "timestamp":CURRENT_TIME_IN_MILLISECONDS_HERE, 
           "attributes":{"host.name":"dev.server.com"} 
           }] 
    }]'

Regards,
Umesh - Pegasystems

Hey Umesh,

Thanks for reaching out to the community.

Reviewing the status code in our doc’s here: Trace API general requirements and limits | New Relic Documentation. The error code is related to an authentication error. This may occur with an invalid license key or if you lack the necessary entitlement to use the Trace API.

Can you confirm you are using a User Key and not the accounts REST API key as that key can only be used for Read-only requests: New Relic API keys | New Relic Documentation

Let me know.

Cheers,

1 Like

I used the Insert Keys and it worked fine! We can close the topic!