IBM watsonx.ai REST API
You can work with foundation models in IBM watsonx.ai programmatically by using the watsonx.ai API.
See the watsonx.ai API reference documentation.
You can also use the REST API to perform the following tasks:
- Get foundation model information
- Inference foundation models
- Extract text from documents
- Vectorize text
- Rerank document passages
- Add generative chat to your applications with the chat API
- Build agent-driven chat workflows
- Tune a foundation model
- Forecast future values
Prerequisites
For quick access to the following information, open the Developer access page:
- Base URL for API endpoints
- Project or space ID
To open the page, from the watsonx.ai home page for the project or space that you want to work with, open the Navigation Menu ,
and then click Developer access.
You also need the following information to submit REST API requests:
-
A bearer token. For details, see Credentials for programmatic access.
-
The
{model_id}for the foundation model that you want to use. See Getting information about available foundation models. -
The date on which you created and tested your code in the version parameter that is required with each request. For example,
version=2025-02-06.
Some tasks require you to reference data that is made available as a data connection. For more information about how to add a file, and then reference a file from the API, see Adding files to reference from the API.