Generate API Access Token for Sandbox
Generate an API access token for a sandbox Vault. Tokens are preserved upon refreshing a sandbox. Learn more about generating access tokens and how they are retained when managing sandboxes.
POST
https://{vaultDNS}/api/{version}/objects/sandbox/{sandbox_name}/users/me/api_access_token__sysHeaders
Section link for Headers| Name | Description |
|---|---|
Authorization | The Vault sessionId or Bearer {access_token}. If you do not have any existing access tokens, you must use another method to authenticate to Vault API and obtain a valid session ID. |
Content-Type | application/x-www-form-urlencoded or application/json |
Accept | application/json |
URI Path Parameters
Section link for URI Path Parameters| Name | Description |
|---|---|
sandbox_name | The name of the sandbox Vault to create the access token for. This is the name which appears on the My Vaults page. |
Body Parameters
Section link for Body Parameters| Name | Description |
|---|---|
name__vrequired | The name or description of the access token. |
expiry_date__voptional | The expiration date of the access token, in YYYY-MM-DDTHH:MM:SSZ format. Dates and times are in UTC. If the time is not specified, it will default to before midnight (23:59:59) in the user's timezone on the specified date. The maximum expiration period may vary based on the user's security profile. If allowed by the user's security profile, this parameter can be omitted to indicate the access token never expires. |
Request
Section link for Requestcurl -X POST -H "Authorization: {AUTH_VALUE}" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "name__v=IntegrationKey" \
-d "expiry_date__sys=2025-12-31T12:00:00:00.000Z" \
https://myvault.veevavault.com/api/v26.2/objects/sandbox/VeePharmSandbox/users/me/api_access_token__sysResponse
Section link for Response{
"responseStatus": "SUCCESS",
"data": {
"id": "0PI00000000C003",
"token__sys": "veeva-vault-B5A79ABC..."
}
}Response Details
Section link for Response DetailsOn SUCCESS, this request returns the id for the access token as well as its value (token__sys). The access token's value is only visible upon creation and should be stored safely. If lost, you cannot recover this value and must generate a new access token for the specified sandbox Vault.