Let us know so we can improve!
The online Trailblazer Community becomes read-only Oct 30, 2026. Read More
The Salesforce My Trust Center API authenticates every request with a personal access token (PAT). You create your first PAT in Salesforce My Trust Center. To keep your integration running without manual steps, refresh the PAT from your integration before it expires.
exp claim.prod-servicenow.Treat your PAT like a password. Don’t commit it to source control or include it in logs.
Important
Send the PAT as a Bearer token in the Authorization header of every request.
1curl https://api.salesforce.com/platform/mytrust/v1/status \
2 -H "Authorization: Bearer $MYTRUST_PAT"If the PAT is missing, invalid, revoked, or expired, the API returns 401 with this body.
1{
2 "error": "unauthorized"
3}To estimate when a PAT expires, decode the JWT payload locally and read the exp claim. The value is in Unix seconds.
1echo "$MYTRUST_PAT" | cut -d. -f2 | tr '_-' '/+' | base64 -d 2>/dev/nullThe output looks like this.
1{"exp":1791428400}Don’t verify the JWT signature, because the signing key isn’t published. The decoded exp value is an estimate. The server’s expiry and revocation status are authoritative. If the command prints a truncated payload, add = padding to the end of the payload segment.
Note
To replace your current PAT with a new one, send a POST request to /pats/refresh with the current PAT in the Authorization header. The current PAT must be active.
1curl -X POST https://api.salesforce.com/platform/mytrust/v1/pats/refresh \
2 -H "Authorization: Bearer $MYTRUST_PAT" \
3 -H "Content-Type: application/json" \
4 -d '{"expiresInDays": 7}'The request body is optional. If you omit it, the new PAT is valid for 30 days. To request a shorter lifetime, set expiresInDays to a whole number from 1 through 30.
The response contains the new PAT in secret.
1{
2 "tokenId": "9aa0b1c2-d3e4-4f56-a789-0123456789ab",
3 "secret": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3OTE0Mjg0MDB9.example-signature",
4 "label": "prod-servicenow",
5 "createdAt": "2026-09-08T03:00:00.000Z",
6 "expiresAt": "2026-10-08T03:00:00.000Z"
7}When the refresh succeeds, the API revokes your current PAT immediately. Store the new secret before you send another request, because the API never returns it again. The old and new PATs don’t overlap, and a refresh isn’t idempotent. If you lose the new PAT, revoke it in My Trust Center, and then create a PAT.
Warning
We recommend that you refresh the PAT on a schedule, well before expiresAt, and write the new secret to your secrets manager in the same step.
A refresh request can fail with an authentication error, a rate-limit error, or a server error. Because a refresh isn’t idempotent, how you recover depends on whether the API replaced your PAT.
The refresh endpoint returns the same 401 response for every authentication failure.
expiresInDays value is invalid.For security, the response doesn’t include a message, so the response doesn’t reveal whether your PAT is otherwise valid. To recover, check that expiresInDays is a whole number from 1 through 30, and then retry. If the request still fails, revoke your PAT in My Trust Center, and then create a PAT.
If you send too many refresh requests, the API returns 429 with a Retry-After header. The API rejects the request before it replaces your PAT, so your current PAT stays active. Wait the number of seconds in the Retry-After header, and then retry the refresh.
1{
2 "error": "rateLimitExceeded",
3 "message": "Rate limit exceeded. Retry after the period indicated in the Retry-After header."
4}If the refresh returns 500 or times out, you can’t tell from the response whether the API replaced your PAT. Don’t retry the refresh right away. Instead, check whether your current PAT still works.
Send a request that doesn’t change anything, such as listing your tenants, with your current PAT.
1curl "https://api.salesforce.com/platform/mytrust/v1/tenants?pageSize=1" \
2 -H "Authorization: Bearer $MYTRUST_PAT"If the request succeeds, the API didn’t replace your PAT. Wait, and then retry the refresh.
If the request returns 401, the API likely replaced your PAT but didn’t deliver the new one. Revoke your PAT in My Trust Center, and then create a PAT.