To exchange a Workday OAuth 2.0 refresh token for a new Bearer access token, send an HTTP POST request to your tenant’s Token Endpoint (https://<host>/ccx/oauth2/<tenant>/token) with Content-Type: application/x-www-form-urlencoded and an Authorization: Basic <base64(client_id:client_secret)> header. Pass grant_type=refresh_token and the refresh_token parameter in the URL-encoded request body, never as JSON.
Exact HTTP Request and Response Format
Workday’s tenant Token Endpoint follows RFC 6749 Section 6 for refresh token grants. Every request requires three pieces: the tenant-specific URL, the Authorization: Basic header containing Base64-encoded client credentials, and a form-encoded body with two fields.
POST /ccx/oauth2/your_tenant/token HTTP/1.1
Host: wd2-impl-services1.workday.com
Content-Type: application/x-www-form-urlencoded
Authorization: Basic <base64(client_id:client_secret)>Send these two keys in the application/x-www-form-urlencoded body:
| Form Field | Required Value |
|---|---|
Form Fieldgrant_type |
Required Valuerefresh_token |
Form Fieldrefresh_token |
Required ValueThe refresh credential issued by Workday for this API client and user |
Building the Basic Authentication Header
Concatenate your Client ID and Client Secret with a single colon and no spaces:
client_id:client_secretEncode that exact string in Base64 without a trailing newline. In a shell script, use printf rather than echo, because echo appends a newline character that corrupts the secret and triggers invalid_client:
AUTH_HEADER=$(printf '%s:%s' "$WORKDAY_CLIENT_ID" "$WORKDAY_CLIENT_SECRET" | base64 | tr -d '\n')Then send the POST request with --data-urlencode so special characters inside the refresh credential are safely encoded (reading the refresh value from standard input with @- keeps it out of shell history and process listings):
printf '%s' "$WORKDAY_REFRESH_TOKEN" | curl --request POST \
"https://wd2-impl-services1.workday.com/ccx/oauth2/your_tenant/token" \
--header "Content-Type: application/x-www-form-urlencoded" \
--header "Authorization: Basic ${AUTH_HEADER}" \
--data-urlencode "grant_type=refresh_token" \
--data-urlencode "refresh_token@-"In Node.js, URLSearchParams sets the application/x-www-form-urlencoded body automatically:
const basic = Buffer.from(`${clientId}:${clientSecret}`).toString("base64");
const body = new URLSearchParams([
["grant_type", "refresh_token"],
["refresh_token", refreshToken],
]);
const response = await fetch("https://wd2-impl-services1.workday.com/ccx/oauth2/your_tenant/token", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: `Basic ${basic}`,
},
body,
});Expected 200 OK Response
When the client credentials and refresh credential are valid, Workday returns HTTP 200 OK with a JSON payload containing the Bearer access credential.
{
"access_token": "28tyw9mpe7huyyah7gftg4djg",
"refresh_token": "1fndsc9ezoe4s4rbwrzzobgzw7l3os123o0qn1wckmf7zfv5o9v9r5l7cdra51e1",
"token_type": "Bearer"
}Pass the returned access_token on subsequent Workday REST API calls as Authorization: Bearer <access_token>. For user-delegated OAuth clients, Workday rotates the refresh_token on each exchange, so store the new value when one is returned. For integration clients configured with non-expiring refresh tokens, the stored refresh token continues to mint new access tokens until an administrator regenerates or revokes it. See Managing Workday OAuth Refresh Token Expiration, Rotation, and Revocation for how rotation and fixed timeouts behave across both client types.
HTTP Basic Auth vs. Body Credentials (and Tenant vs. Extend URLs)
Workday API clients authenticate with client_id and client_secret, and where you place those credentials determines whether the token endpoint accepts the request.
| Client Setup | Token Endpoint Host | Client Authentication | Body Parameters |
|---|---|---|---|
Client SetupTenant API Client for Integrations (Register API Client for Integrations) |
Token Endpoint Hosthttps://<host>/ccx/oauth2/<tenant>/token |
Client AuthenticationAuthorization: Basic <base64(client_id:client_secret)> |
Body Parametersgrant_type (refresh_token), refresh_token |
| Client SetupWorkday Extend Developer Site API Client | Token Endpoint Hosthttps://auth.api.workday.com/v1/token (or regional api.<region>.wcp.workday.com/auth/v1/token) |
Client AuthenticationBase64 client_id:client_secret in Authorization header |
Body Parametersgrant_type (refresh_token), client_id, refresh_token |
For tenant endpoints (/ccx/oauth2/<tenant>/token), default to HTTP Basic Authentication in the Authorization header and omit client_id and client_secret from the form body. Placing client credentials only in the POST body fails on gateways and middleware configurations that enforce Basic authentication, and sending mismatched values in both places triggers invalid_client.
Do not mix tenant API clients with Workday Extend authorization base URLs. A client created inside a Workday tenant via Register API Client for Integrations only authenticates against that tenant’s /ccx/oauth2/<tenant>/token endpoint. Calling auth.api.workday.com/v1/token with a tenant Client ID returns 401 Unauthorized or invalid_client.
Setting Up the API Client and Finding Your Token Endpoint
Registering an API client and issuing its refresh token requires access to the Integration Security domain (Integration functional area) along with the Set Up: Tenant Setup - Security and Security Administration domains (System functional area).
- Run the Register API Client for Integrations task in Workday.
- Enter a unique Client Name and select the Scope (Functional Areas) that match the REST endpoints your integration calls.
- Choose the refresh token lifetime. Select Non-Expiring Refresh Tokens for unattended integrations that run continuously. If your security policy requires expiring tokens, leave that box unchecked and set Refresh Token Timeout (in days). That timeout starts at initial authorization and does not reset when you exchange a refresh token.
- Click OK, then copy and store the Client ID and Client Secret. Workday does not display the Client Secret again after you leave the confirmation page.
- Run View API Clients, open the API Clients for Integrations tab, and locate your new client. Copy the exact Token Endpoint URL (
https://<host>/ccx/oauth2/<tenant>/token) and Workday REST API Endpoint from the page rather than guessing the data center hostname. - From the client’s related actions menu, select API Client > Manage Refresh Tokens for Integrations.
- Select the Integration System User (ISU) in the Workday Account field and click OK.
- Select Generate New Refresh Token, click OK, and copy the token from the Successfully Regenerated Refresh Token page.
Refresh tokens are bound to the specific Workday user account selected in step 7. If that ISU is deactivated or its username changes, every refresh token tied to it stops working immediately.
Troubleshooting Workday Token Endpoint Errors
Token endpoint failures return HTTP 400 Bad Request or 401 Unauthorized with a JSON error payload. Match the returned error string to its cause below.
| HTTP Status | OAuth Error Code | Common Cause in Workday | Fix |
|---|---|---|---|
HTTP Status401 or 400 |
OAuth Error Codeinvalid_client |
Common Cause in WorkdayMalformed Authorization: Basic header (extra space around :, trailing newline in Base64 input, or missing Basic prefix). |
FixRe-encode client_id:client_secret with printf '%s:%s' and verify the header begins with Basic . |
HTTP Status401 or 400 |
OAuth Error Codeinvalid_client |
Common Cause in WorkdayClient Secret was regenerated in Workday, or credentials were sent in the body instead of the Authorization: Basic header. |
FixUpdate the stored secret from View API Clients (or generate a new secret) and send credentials in the Authorization: Basic header. |
HTTP Status401 or 400 |
OAuth Error Codeinvalid_client |
Common Cause in WorkdayTenant mismatch after a Sandbox refresh, where the URL points to one tenant while the Client ID belongs to another. | FixCopy the exact Token Endpoint from View API Clients in the target tenant and verify the Client ID exists there. |
HTTP Status400 |
OAuth Error Codeinvalid_grant |
Common Cause in WorkdayThe refresh token expired (fixed Refresh Token Timeout elapsed), was revoked, or was superseded by a newer token generated in Manage Refresh Tokens for Integrations. | FixGenerate a new refresh token via API Client > Manage Refresh Tokens for Integrations (or repeat the authorization code flow for user-delegated clients). |
HTTP Status400 |
OAuth Error Codeinvalid_grant |
Common Cause in WorkdayThe bound ISU is locked, deactivated, has an expired password, or had its username changed. | FixVerify the ISU account status and security group policies in Workday, then regenerate the refresh token if the username changed. See Troubleshooting Workday ISU Authentication Errors. |
HTTP Status400 |
OAuth Error Codeunsupported_grant_type |
Common Cause in WorkdayContent-Type was set to application/json, grant_type is missing or misspelled, or the API client is not configured for the requested grant type. |
FixSet Content-Type: application/x-www-form-urlencoded, send grant_type=refresh_token in the body, and confirm the client was registered for refresh token grants. |
Verification Checklist Before Deploying
Before wiring a token refresh call into production middleware or a scheduled job, verify four details against your tenant:
- The request URL matches the Token Endpoint shown on View API Clients for that exact environment (Implementation, Sandbox, or Production).
- The
Authorizationheader starts withBasicfollowed by single-line Base64 output ofclient_id:client_secretwith no trailing newline. - The request sends
Content-Type: application/x-www-form-urlencodedand URL-encodes therefresh_tokenvalue. - The Integration System User bound under Manage Refresh Tokens for Integrations is active, exempt from password expiration policies that break unattended jobs, and assigned to an activated Integration System Security Group with access to the target domains.