Paper endpoint for token generation not working anymore?

Hi,

I cannot access paper api endpoint - is it not working anymore or has it been changed?

https://paper-api.alpaca.markets/oauth/token
result: {“message”: “endpoint not found.”}

@DisguisedDonkey I believe you have the wrong endpoint. It should as below (note the base URL is api and not paper-api).

POST https://api.alpaca.markets/oauth/token

Check out the docs here.

@Dan_Whitnable_Alpaca
https://alpaca.markets/docs/api-references/trading-api/#paper-trading

To use the paper trading api, set APCA-API-KEY-ID and APCA-API-SECRET-KEY to your paper credentials, and set the domain to paper-api.alpaca.markets .

What is this?

I know the live endpoint API is api.alpaca.markets. What happened to the paper endpoint API?

@DisguisedDonkey For the Trading APIs, the paper base URL is paper-api.alpaca.markets and the live account base URL is api.alpaca.markets. Those haven’t changed. Ensure you use your paper API keys with the paper base URL and the live account keys with the live base URL (they are different).

For the OAuth APIs the base URL is api.alpaca.markets. The /oauth/token endpoint only exists in api.alpaca.markets

For the Market Data APIs the base URL is data.alpaca.markets.

Does that help?

@Dan_Whitnable_Alpaca How can I get the access token without using oauth/token endpoint for paper API?

@DisguisedDonkey The OAuth token one receives from the api.alpaca.markets/oauth/token endpoint can be used to authenticate both live and paper Trading API calls. However, in most cases, if you are simply trading your own account(s) there is no need to ever fetch an OAuth token or use OAuth at all. Individual traders should authenticate Trading API calls using their API Key and Secret Key These keys can be generated from the dashboard as shown below


First click “View API Keys” then click “Regenerate”. The API key will always show but the Secret Key is only displayed once immediately after regenerating the key. Ensure you copy and save it in a secure place.

Use those keys to authenticate and not an OAuth token if you are simply trading your own account.

2 Likes

Thank you, this solved the issue!