How can I use my PAT?
The PAT should be included in the Authorization
header when making a request to a Model-Prime API endpoint.
You can see examples of curl
requests that include the Authorization
header in the Swagger UI.
NOTE: The token generated by Swagger and included in the
curl
requests is a valid token but is different from a generated PAT and has a significantly shorter lifespan than those you are able to create. It is not recommended to use that token for ongoing programmatic API access.
For any endpoint, click on "Try it out" and execute the request, editing the request body first if required. In the Responses section, you will see a curl
request similar to that below.
You can copy the curl request, replacing the string following 'Authorization:
with the token returned by the service when you created the PAT.
Using the example from when a token was created in Step 1 as a reference, our Authorization header would look like the following: 'Authorization: robot@model-prime.com:mpat_rhlI7qcgWuhD2gFPpQVlzNfRCSpQ82sK'
. The PAT token contains the same roles and permissions as the account which was used to log into the Swagger UI.
Validating your PAT
You may validate that the PAT is working by hitting our GET /account
endpoint with curl.
> curl -X 'GET' \
'https://api.model-prime.com/api/pat/v1/account' \
-H 'accept: application/json' \
-H 'Authorization: robot@model-prime.com:mpat_rhlI7qcgWuhD2gFPpQVlzNfRCSpQ82sK`
{"email":"robot@model-prime.com","organization":"Model-Prime"}