Welcome to the Alteryx Knowledge Base
Created/Edited -
Use Alteryx One APIs to automate workflow execution and retrieve outputs from external applications such as Python scripts, shell scripts, and other API clients. This approach allows users to trigger workflows programmatically instead of manually running them through the Alteryx One user interface.
This article explains how to:
* Configure OAuth 2.0 API access in an Alteryx One workspace.
* Generate access and refresh tokens.
* Obtain a new access token using a refresh token.
* Execute an Orchestrator Plan through the Alteryx One API.
After completing these steps, users will be able to authenticate against Alteryx One APIs and trigger workflow execution programmatically.
AAC Environment
Before using the API:
* API Access must be enabled for your workspace.
* A service account is recommended for API execution.
* Service accounts are intended for API execution only and cannot be used to log in to the Alteryx Analytics Cloud user interface.
* Users must have permission to generate OAuth 2.0 API tokens.
1. Generate OAuth 2.0 API tokens.
1. Select your **Profile Icon**.
2. Select **User Preferences**.
3. Select **OAuth 2.0 API Tokens**.
4. Select **Generate**.
5. Generate both an Access Token and Refresh Token.
6. To create a token that does not expire, set the maximum number of days to **-1**.
2. Record the generated values.
* Client ID
* Token Endpoint URL
* Refresh Token
Example:
* Client ID: `af1b5321-afe0-48c2-966a-c77d74e98085` * Token Endpoint URL: `https://pingauth.alteryxcloud.com/as`
3. Obtain a new access token using the refresh token.
```bash
curl --request POST \ --url 'https://pingauth.alteryxcloud.com/as/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data 'grant_type=refresh_token' \ --data 'client_id=af1b5321-afe0-48c2-966a-c77d74e98085' \ --data 'refresh_token=<token here>'
```
4. Create an Orchestrator Plan.
* Use Orchestrator to coordinate workflow execution across Alteryx One.
* Once the plan is created, note the generated Plan ID.
5. Execute the Plan using the API.
Example:
```bash
curl --location --request POST \ 'https://api.us1.alteryxcloud.com/plans/v1/plans/124479/run' \ --header 'Authorization: Bearer <access token here>' \ --header 'Content-Type: application/json' \ --data '{}'
```
6. Verify the response.
Example response:
```json { "validationStatus": "Valid", "planSnapshotRunId": 726713 } ```
Expected HTTP status:
```text HTTP_STATUS:201
```
**Token Information**
* Access Token lifetime: 60 minutes.
* Refresh Token can be used to obtain a new access token without requiring re-authentication.
**Documentation**
* OAuth 2.0 API Tokens:
https://help.alteryx.com/aac/en/platform/admin/admin-reference/admin-console/workspace-settings-page.html#oauth-2-0-api-tokens-4694361
* Orchestrator Overview:
https://help.alteryx.com/aac/en/orchestrator/get-started-with-orchestrator.html#get-started-with-orchestrator
* Managed Plans API:
https://api-docs.us1.alteryxcloud.com/docs/managed-plans-v1/1/overview