- 27 May 2025
- 1 Minute to read
- Print
- DarkLight
- PDF
Auto-CSV Upload Scripts
- Updated on 27 May 2025
- 1 Minute to read
- Print
- DarkLight
- PDF
Retrieve your URI and Token Values
URI
Your URI will be determined by the subdomain of your Clarity tenant.
Format: https://YOUR_TENANT.claritysecurity.io/api/auto-upload-file
Example: https://example.claritysecurity.io/api/auto-upload-file
API Token
To retrieve your secure token, head to the Auto-CSV app in your tenant, click on the pencil icon in the top right corner, and look for the API Access Token field. Securely store this value for use in the scripts below.
Token Example
Take proper security precautions for securing this API Token value.
The token below is just an example, you will need to grab the actual token from your Clarity Tenant after navigating to the particular application.
Python
Please follow best practices for securing the API token for your script.
Secure your Token
Please follow best practices for securing the API token for your script.
Single File
Coming Soon.py
Multiple Files
Coming Soon.py
Powershell
Below are some examples of how to format the data.
Powershell Invoke-RestMethod
Cmdlet Documentation : https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.5#example-6-simplified-multipart-form-data-submission
Secure your Token
Please follow best practices for securing the API token for your script.
Single File
This is an example for an application with just one file to ingest.
$uri = "https://example.claritysecurity.io/api/auto-upload-file"
$token = "EpyCKbsmagyTddhAhCZNytk2vZu7JMjuRENSKF5GvbJXPmgQ6BtFH7lCGaWS"
$headers = @{
"content-type" = "multipart/form-data"
"accept" = "application/json"
"authorization" = "Bearer $token"
}
$Form = @{
"file" = Get-Item -Path "C:\Files\example_users_groups.csv"
}
Invoke-RestMethod -Uri $uri -Method Post -Headers $headers -Form $Form
Multiple Files
This is an example for an application with multiple files to ingest.
$uri = "https://example.claritysecurity.io/api/auto-upload-file"
$token = "EpyCKbsmagyTddhAhCZNytk2vZu7JMjuRENSKF5GvbJXPmgQ6BtFH7lCGaWS"
$file_list = @(
"C:\Files\example_users.xslx",
"C:\Files\example_groups.xlsx",
"C:\Files\example_user_groups.xlsx"
)
$headers = @{
"content-type" = "multipart/form-data"
"accept" = "application/json"
"authorization" = "Bearer $token"
}
foreach ($file in $file_list) {
$Form = @{
"file" = Get-Item -Path $file
}
Invoke-RestMethod -Uri $uri -Method Post -Headers $headers -Form $Form
}
Need help?
If you have any problems, contact your customer success team. You can also get in touch with our general support via email, open a support ticket. Our general support team is available Monday - Friday from 8:00 AM - 6:30 PM CST.