--- id: v2024-personal-access-tokens title: PersonalAccessTokens pagination_label: PersonalAccessTokens sidebar_label: PersonalAccessTokens sidebar_class_name: powershellsdk keywords: ['powershell', 'PowerShell', 'sdk', 'PersonalAccessTokens'] slug: /tools/sdk/powershell/v2024/methods/personal-access-tokens tags: ['SDK', 'Software Development Kit', 'PersonalAccessTokens'] --- # PersonalAccessTokens All URIs are relative to *https://sailpoint.api.identitynow.com/v2024* Method | HTTP request | Description ------------- | ------------- | ------------- [**New-V2024PersonalAccessToken**](#create-personal-access-token) | **POST** `/personal-access-tokens` | Create Personal Access Token [**Remove-V2024PersonalAccessToken**](#delete-personal-access-token) | **DELETE** `/personal-access-tokens/{id}` | Delete Personal Access Token [**Get-V2024PersonalAccessTokens**](#list-personal-access-tokens) | **GET** `/personal-access-tokens` | List Personal Access Tokens [**Update-V2024PersonalAccessToken**](#patch-personal-access-token) | **PATCH** `/personal-access-tokens/{id}` | Patch Personal Access Token ## create-personal-access-token This creates a personal access token. ### Parameters Param Type | Name | Data Type | Required | Description ------------- | ------------- | ------------- | ------------- | ------------- Body | CreatePersonalAccessTokenRequest | [**CreatePersonalAccessTokenRequest**](../models/create-personal-access-token-request) | True | Name and scope of personal access token. ### Return type [**CreatePersonalAccessTokenResponse**](../models/create-personal-access-token-response) ### Responses Code | Description | Data Type ------------- | ------------- | ------------- 200 | Created. Note - this is the only time Personal Access Tokens' secret attribute will be displayed. | CreatePersonalAccessTokenResponse 400 | Client Error - Returned if the request body is invalid. | ErrorResponseDto 401 | Unauthorized - Returned if there is no authorization header, or if the JWT token is expired. | ListAccessProfiles401Response 403 | Forbidden - Returned if the user you are running as, doesn't have access to this end-point. | ErrorResponseDto 429 | Too Many Requests - Returned in response to too many requests in a given period of time - rate limited. The Retry-After header in the response includes how long to wait before trying again. | ListAccessProfiles429Response 500 | Internal Server Error - Returned if there is an unexpected error. | ErrorResponseDto ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ### Example ```powershell $CreatePersonalAccessTokenRequest = @"{ "scope" : [ "demo:personal-access-token-scope:first", "demo:personal-access-token-scope:second" ], "accessTokenValiditySeconds" : 36900, "name" : "NodeJS Integration" }"@ # Create Personal Access Token try { $Result = ConvertFrom-JsonToCreatePersonalAccessTokenRequest -Json $CreatePersonalAccessTokenRequest New-V2024PersonalAccessToken-V2024CreatePersonalAccessTokenRequest $Result # Below is a request that includes all optional parameters # New-V2024PersonalAccessToken -V2024CreatePersonalAccessTokenRequest $CreatePersonalAccessTokenRequest } catch { Write-Host $_.Exception.Response.StatusCode.value__ "Exception occurred when calling New-V2024PersonalAccessToken" Write-Host $_.ErrorDetails } ``` [[Back to top]](#) ## delete-personal-access-token This deletes a personal access token. ### Parameters Param Type | Name | Data Type | Required | Description ------------- | ------------- | ------------- | ------------- | ------------- Path | Id | **String** | True | The personal access token id ### Return type (empty response body) ### Responses Code | Description | Data Type ------------- | ------------- | ------------- 204 | No content. | 400 | Client Error - Returned if the request body is invalid. | ErrorResponseDto 401 | Unauthorized - Returned if there is no authorization header, or if the JWT token is expired. | ListAccessProfiles401Response 403 | Forbidden - Returned if the user you are running as, doesn't have access to this end-point. | ErrorResponseDto 404 | Not Found - returned if the request URL refers to a resource or object that does not exist | ErrorResponseDto 429 | Too Many Requests - Returned in response to too many requests in a given period of time - rate limited. The Retry-After header in the response includes how long to wait before trying again. | ListAccessProfiles429Response 500 | Internal Server Error - Returned if there is an unexpected error. | ErrorResponseDto ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### Example ```powershell $Id = "ef38f94347e94562b5bb8424a56397d8" # String | The personal access token id # Delete Personal Access Token try { Remove-V2024PersonalAccessToken-V2024Id $Id # Below is a request that includes all optional parameters # Remove-V2024PersonalAccessToken -V2024Id $Id } catch { Write-Host $_.Exception.Response.StatusCode.value__ "Exception occurred when calling Remove-V2024PersonalAccessToken" Write-Host $_.ErrorDetails } ``` [[Back to top]](#) ## list-personal-access-tokens This gets a collection of personal access tokens associated with the optional `owner-id`. query parameter. If the `owner-id` query parameter is omitted, all personal access tokens for a tenant will be retrieved, but the caller must have the 'idn:all-personal-access-tokens:read' right. ### Parameters Param Type | Name | Data Type | Required | Description ------------- | ------------- | ------------- | ------------- | ------------- Query | OwnerId | **String** | (optional) | The identity ID of the owner whose personal access tokens should be listed. If ""me"", the caller should have the following right: 'idn:my-personal-access-tokens:read' If an actual owner ID or if the `owner-id` parameter is omitted in the request, the caller should have the following right: 'idn:all-personal-access-tokens:read'. If the caller has the following right, then managed personal access tokens associated with `owner-id` will be retrieved: 'idn:managed-personal-access-tokens:read' Query | Filters | **String** | (optional) | Filter results using the standard syntax described in [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters#filtering-results) Filtering is supported for the following fields and operators: **lastUsed**: *le, isnull* ### Return type [**GetPersonalAccessTokenResponse[]**](../models/get-personal-access-token-response) ### Responses Code | Description | Data Type ------------- | ------------- | ------------- 200 | List of personal access tokens. | GetPersonalAccessTokenResponse[] 400 | Client Error - Returned if the request body is invalid. | ErrorResponseDto 401 | Unauthorized - Returned if there is no authorization header, or if the JWT token is expired. | ListAccessProfiles401Response 403 | Forbidden - Returned if the user you are running as, doesn't have access to this end-point. | ErrorResponseDto 429 | Too Many Requests - Returned in response to too many requests in a given period of time - rate limited. The Retry-After header in the response includes how long to wait before trying again. | ListAccessProfiles429Response 500 | Internal Server Error - Returned if there is an unexpected error. | ErrorResponseDto ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### Example ```powershell $OwnerId = "2c9180867b50d088017b554662fb281e" # String | The identity ID of the owner whose personal access tokens should be listed. If ""me"", the caller should have the following right: 'idn:my-personal-access-tokens:read' If an actual owner ID or if the `owner-id` parameter is omitted in the request, the caller should have the following right: 'idn:all-personal-access-tokens:read'. If the caller has the following right, then managed personal access tokens associated with `owner-id` will be retrieved: 'idn:managed-personal-access-tokens:read' (optional) $Filters = 'lastUsed le 2023-02-05T10:59:27.214Z' # String | Filter results using the standard syntax described in [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters#filtering-results) Filtering is supported for the following fields and operators: **lastUsed**: *le, isnull* (optional) # List Personal Access Tokens try { Get-V2024PersonalAccessTokens # Below is a request that includes all optional parameters # Get-V2024PersonalAccessTokens -V2024OwnerId $OwnerId -V2024Filters $Filters } catch { Write-Host $_.Exception.Response.StatusCode.value__ "Exception occurred when calling Get-V2024PersonalAccessTokens" Write-Host $_.ErrorDetails } ``` [[Back to top]](#) ## patch-personal-access-token This performs a targeted update to the field(s) of a Personal Access Token. Changing scopes for a Personal Access Token does not impact existing bearer tokens. You will need to create a new bearer token to have the new scopes. Please note that it can take up to 20 minutes for scope changes to be seen on new bearer tokens. ### Parameters Param Type | Name | Data Type | Required | Description ------------- | ------------- | ------------- | ------------- | ------------- Path | Id | **String** | True | The Personal Access Token id Body | JsonPatchOperation | [**[]JsonPatchOperation**](../models/json-patch-operation) | True | A list of OAuth client update operations according to the [JSON Patch](https://tools.ietf.org/html/rfc6902) standard. The following fields are patchable: * name * scope ### Return type [**GetPersonalAccessTokenResponse**](../models/get-personal-access-token-response) ### Responses Code | Description | Data Type ------------- | ------------- | ------------- 200 | Indicates the PATCH operation succeeded, and returns the PAT's new representation. | GetPersonalAccessTokenResponse 400 | Client Error - Returned if the request body is invalid. | ErrorResponseDto 401 | Unauthorized - Returned if there is no authorization header, or if the JWT token is expired. | ListAccessProfiles401Response 403 | Forbidden - Returned if the user you are running as, doesn't have access to this end-point. | ErrorResponseDto 404 | Not Found - returned if the request URL refers to a resource or object that does not exist | ErrorResponseDto 429 | Too Many Requests - Returned in response to too many requests in a given period of time - rate limited. The Retry-After header in the response includes how long to wait before trying again. | ListAccessProfiles429Response 500 | Internal Server Error - Returned if there is an unexpected error. | ErrorResponseDto ### HTTP request headers - **Content-Type**: application/json-patch+json - **Accept**: application/json ### Example ```powershell $Id = "ef38f94347e94562b5bb8424a56397d8" # String | The Personal Access Token id # JsonPatchOperation[] | A list of OAuth client update operations according to the [JSON Patch](https://tools.ietf.org/html/rfc6902) standard. The following fields are patchable: * name * scope $JsonPatchOperation = @"{ "op" : "replace", "path" : "/description", "value" : "New description" }"@ # Patch Personal Access Token try { $Result = ConvertFrom-JsonToJsonPatchOperation -Json $JsonPatchOperation Update-V2024PersonalAccessToken-V2024Id $Id -V2024JsonPatchOperation $Result # Below is a request that includes all optional parameters # Update-V2024PersonalAccessToken -V2024Id $Id -V2024JsonPatchOperation $JsonPatchOperation } catch { Write-Host $_.Exception.Response.StatusCode.value__ "Exception occurred when calling Update-V2024PersonalAccessToken" Write-Host $_.ErrorDetails } ``` [[Back to top]](#)