Guides
The Hautech API supports workflows that simplify preparing and processing images. Each workflow wraps multiple operations so developers can obtain results with a single call. This section covers uploading images, running asynchronous operations, tracking usage, and managing access to resources.
Upload image
Uploading an image involves three API calls:
-
Initialize upload: Call
/v1/images/upload/initializeto receive the pre-signed upload URL.curl -X POST "https://api.hautech.ai/v1/images/upload/initialize" \ -H "Authorization: Bearer <your_jwt_access_token>" -
Upload the file: Use the URL from the previous step to upload your image with
multipart/form-data. The response returns a file token.curl -X PUT "https://upload.url.received/from/initialize" \ -F "file=@/path/to/your/image.jpg" -
Finalize upload: Call
/v1/images/upload/finalizewith the file token to receive animageId.curl -X POST "https://api.hautech.ai/v1/images/upload/finalize" \ -H "Authorization: Bearer <your_jwt_access_token>" \ -H "Content-Type: application/json" \ -d '{"fileToken": "<your_file_token>"}'
Run operations
All AI operations run asynchronously.
-
Start the operation: Call
/v1/operations/run/*for the desired operation. The API creates a new operation with status"pending".curl -X POST "https://api.hautech.ai/v1/operations/run/haute.linda.v1" \ -H "Authorization: Bearer <your_jwt_access_token>" \ -H "Content-Type: application/json" \ -d '{"input": {"productImageId": "img_123"}}' -
Retrieve the result: Poll
/v1/operations/{operationId}until the operation completes.curl -X GET "https://api.hautech.ai/v1/operations/<ID>" \ -H "Authorization: Bearer <your_jwt_access_token>"
API usage tracking and limiting
Track and manage usage for end users by provisioning accounts and assigning balances.
-
Create an end-user account:
curl -X POST "https://api.hautech.ai/v1/accounts" \ -H "Authorization: Bearer <your_jwt_access_token>" \ -H "Content-Type: application/json" \ -d '{"alias": "enduser@example.com"}' -
Add credits to the account:
curl -X PUT "https://api.hautech.ai/v1/accounts/{id}/balance" \ -H "Authorization: Bearer <your_jwt_access_token>" \ -H "Content-Type: application/json" \ -d '{"amount": 100}' -
Sign a JWT for the user account: Generate a self-signed JWT with the minimum permissions required for the end user. Avoid global wildcards.
-
Make calls using the self-signed token: The end user authenticates requests with their scoped token.
Access management
By default, resources (images, collections, operations, stacks, and more) are visible only to the creator account. Use the following mechanisms to share access:
- Access grant: Assign specific permissions to an account or group.
- Access attach: Inherit permissions, such as sharing an image through a collection.
- Groups: Create groups to manage access for multiple accounts simultaneously.
Pricing
Workflow pricing is the sum of every operation in the pipeline. Review the operations included in a workflow to estimate total cost before execution.
Run a workflow
Call the workflow endpoint with its ID and input parameters.
-
Run workflow: Create a new pipeline by calling
/v1/workflows/run/{workflowId}with the required input parameters. The API sets the pipeline status to"pending".curl -X POST "https://api.hautech.ai/v1/workflows/run/{workflowId}" \ -H "Authorization: Bearer <your_jwt_access_token>" \ -H "Content-Type: application/json" \ -d '{"input": {"parameter1": "value1", "parameter2": "value2"}}' -
Retrieve the result: Poll
/v1/pipelines/{pipelineId}until the workflow completes.curl -X GET "https://api.hautech.ai/v1/pipelines/{pipelineId}" \ -H "Authorization: Bearer <your_jwt_access_token>"
Available workflows
Explore a catalog of ready-to-use pipelines in the Available Workflows reference.