Connecting REST API
Step-by-step guide to connect REST APIs to Craveva AI for data integration and AI agent creation.
Connecting REST API
Overview
Connect REST APIs from POS systems, CRMs, delivery platforms, and other services to Craveva AI. Once connected, your AI agents can query these APIs to retrieve real-time data and perform actions.
Prerequisites
- API base URL (e.g.,
https://api.example.com) - API credentials (Bearer token, API key, or username/password)
- API documentation (to understand available endpoints)
Step-by-Step Instructions
1. Navigate to Data Sources
- Go to Data Sources from the main navigation
- Click Connect New Data Source
- Select REST API from the available options
2. Enter Connection Details
- Connection Name: Give your API a descriptive name (e.g., "Shopify API", "Qashier POS API")
- Base URL: Enter the base URL of your REST API
- - Example:
https://api.shopify.com - - Example:
https://api.qashier.com
3. Configure Authentication
Select your authentication type:
#### Bearer Token
- Authentication Type: Select "Bearer Token"
- Bearer Token: Enter your API bearer token
- Commonly used for OAuth2 and modern APIs
#### API Key
- Authentication Type: Select "API Key"
- API Key: Enter your API key
- API Key Header Name: Specify the header name (default: "X-API-Key")
- - Common values:
X-API-Key,Authorization,apikey
#### Basic Auth
- Authentication Type: Select "Basic Auth"
- Username: Enter your API username
- Password: Enter your API password
#### OAuth2
- Authentication Type: Select "OAuth2 (Bearer Token)"
- OAuth2 Access Token: Enter your OAuth2 access token
- Note: Full OAuth2 flow setup coming soon
4. Configure Endpoints (Optional)
Map endpoint names to API paths:
- Key: A friendly name (e.g., "orders", "products")
- Value: The API path (e.g., "/api/v1/orders", "/api/v1/products")
Example:
orders→/api/v1/ordersproducts→/api/v1/productscustomers→/api/v1/customers
This makes it easier to reference endpoints in your agents.
5. Test Connection
- Click Test Connection to verify your API is accessible
- The test will make a GET request to your base URL
- If successful, you'll see a green success message
6. Select Access Mode
- Online (Live Connection): Real-time API queries
- Offline (Cached Data): Use cached API responses
- Hybrid: Combination of both
7. Connect REST API
- Click Connect REST API
- Wait for the connection to be established
- You'll be redirected to see your connected data source
Common Use Cases
POS Systems
- Qashier, StoreHub, MEGAPOS
- Retrieve sales data, inventory levels, customer information
CRMs
- HubSpot, Zoho CRM, Salesforce
- Access customer data, deals, contacts
Delivery Platforms
- Deliveroo, Foodpanda, GrabFood
- Monitor orders, track delivery status
Accounting Systems
- QuickBooks, Xero, MYOB
- Access financial data, invoices, transactions
Authentication Examples
Bearer Token
```
Authorization: Bearer your_token_here
```
API Key in Header
```
X-API-Key: your_api_key_here
```
Basic Auth
```
Authorization: Basic base64(username:password)
```
Troubleshooting
Connection Failed
- Verify your base URL is correct and accessible
- Check if the API requires HTTPS
- Ensure your IP is whitelisted (if required)
Authentication Errors
- Verify your token/key is valid and not expired
- Check the correct header name for API keys
- For OAuth2, ensure your access token hasn't expired
401 Unauthorized
- Double-check your credentials
- Verify the authentication method matches the API requirements
- Check if the token needs to be refreshed
403 Forbidden
- Verify your API key has the necessary permissions
- Check if your account has access to the requested resources
404 Not Found
- Verify the base URL is correct
- Check if the API endpoint path is correct
- Review the API documentation for the correct endpoint structure
Next Steps
- Go to Agent Builder to create an AI agent using this REST API
- Configure your agent to query specific endpoints
- Set up automated workflows using API data
Related Guides
Creating a Custom Inventory Agent
Learn how to build an AI agent that monitors inventory levels, predicts stockouts, and automates reo...
Connecting MongoDB Database
Complete guide to connect your MongoDB database, analyze collections, and create data analysis agent...
Shopify E-commerce Integration
Connect your Shopify store to automate order processing, inventory sync, and customer support....