When a user creates an account and logs in to MyMarketNews, they are authenticating themselves. Authentication allows a user to pull data, save preferences and save reports in MyMarketNews. It also adds an additional layer of security. An authenticated user utilizes their personal API key to retrieve data from MyMarketNews. Follow the steps below to authenticate yourself and obtain your API key.
1. In MyMarketNews, click "Login"
2. You will be taken to an eAuthentication (eAuth) page. If you have an existing eAuth, including a LincPass, you may use it here. Otherwise, click "Register".
3. Complete the information on the registration page. You will receive an email confirmation within a few hours. If you experience any issues, contact eAuthorization.
4. Once you log in with your eAuth, click on your name in My Market News.
5. On the left side of the screen, you will see "Show API key". Click here to reveal your personal API key.
6. In your software, use the API key as the basic authentication username value. You do not need to provide a password.
**Each API key is unique to each account and must only be utilized by that user. To maintain your security and the integrity of MARS, keep it secret and do not share with others.
All API requests must be made over HTTPS. Requests made over plain HTTP will fail. API requests without authentication will also fail.
If you need to authenticate via bearer authorization (e.g., for a cross-origin request), use: -H "Basic<Base64EncodedApiKey:>" instead of -u mars_test_343343:.
cURL: curl https://marsapi.ams.usda.gov/services/v1.1/reports -u mars_test_343343: Excel: https://marsapi.ams.usda.gov/services/v1.1/reports
cURL uses the -u flag to pass basic authentication credentials (adding a colon after your API key prevents cURL from asking for a password).
A sample test API key is included in all the examples on this page.To test requests using your account, replace the sample API key with your actual API key.
TEST API Key: mars_test_343343