I am trying to get data over rest api, but i get a 403. how do i obtain an API key to extract data?

  • 5 August 2022
  • 4 replies
  • 100 views

  • New Member
  • 2 replies

I am trying to use the endpoint https://analytics.eu.amplitude.com/api/2/export and am using a curl command like this:
 

curl -k -u $API_Key:$Secret_Key 'https://amplitude.com/api/2/export?start=${STARTTIME}&end={ENDTIME}' >> filename.zi

If I use the API key for my project, the same one that is used to send data from the web app, i get a error 403.
How do I obtain the correct API keys to extract data from the api?


4 replies

Userlevel 7
Badge +10

Hey @bok 

Assuming you have the EU Residency Server, can you confirm

  • if you are using the correct eu endpoint in your final curl command
  • if you have both the API_Key and Secret_Key correctly copied from the project settings
curl -u $API_Key:$Secret_Key 'https://analytics.eu.amplitude.com/api/2/export?start=${STARTTIME}&end={ENDTIME}' >> filename.zip

@Saish Redkar 
I experience the same 403 with either the eu endpoint or the regular endpoint.
I am 100% certain it is correctly copied, and also see the copy pasted details work for ingesting data.
I also tried to provide the secrets as a base64’ed auth header with the same result.

I assumed I needed a different API key to extract the data again?

Userlevel 4
Badge +7

Hey there, Amplitude Tech support here! 

Can you please send over your Project link? 

 

Thanks! 

@Zhenia Semenina

I have PM’ed you the project link

 

In the mean time i have also tried to import the postman collection, and i also see the 403 error in postman.

Reply