Skip to main content

HTTPS Tool

Make HTTP/HTTPS requests to any REST API endpoint.

Provider: Built-in
Authentication: None required (API-specific auth can be passed in headers)
Category: Utilities
Credit Cost: 1 credit per request

Overview

The HTTPS tool provides a generic HTTP client for calling any REST API. Use it to integrate with services that don't have dedicated tools in Reeva or to make custom API calls with full control over the request.

Available Tool

HTTPS Call

Make HTTP/HTTPS requests with full control over method, headers, body, and other parameters.

Tool ID: HTTPS_Call
Credit Cost: 1 credit

Parameters:

  • method (string, required): HTTP method
    • Options: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS
  • url (string, required): Target URL with protocol
    • Must include http:// or https://
    • Example: "https://api.example.com/users"
  • params (object, optional): Query string parameters
    • Automatically appended to URL
    • Example: {"page": 1, "limit": 10}?page=1&limit=10
  • json (object, optional): JSON request body
    • Automatically sets Content-Type: application/json
    • Use for JSON APIs
  • data (object, optional): Form-encoded data
    • Use for form submissions
    • Sets Content-Type: application/x-www-form-urlencoded
  • headers (object, optional): Custom HTTP headers
    • Example: {"Authorization": "Bearer token123"}
  • cookies (object, optional): Cookies to send
    • Example: {"session_id": "abc123"}
  • timeout (number, optional): Request timeout in seconds
    • Default: 30
  • allow_redirects (boolean, optional): Follow HTTP redirects
    • Default: true
  • proxies (object, optional): Proxy configuration
    • Example: {"http": "http://proxy:8080"}

Response:

{
"status_code": 200,
"headers": {
"content-type": "application/json",
"date": "Fri, 22 Nov 2025 10:30:00 GMT"
},
"body": {
"id": 123,
"name": "Example User",
"email": "user@example.com"
},
"text": "{\"id\":123,\"name\":\"Example User\",\"email\":\"user@example.com\"}",
"url": "https://api.example.com/users/123",
"success": true,
"elapsed_time": 0.245
}

Example Usage

GET Request

# Python - Simple GET request
response = client.call_tool(
name="HTTPS_Call",
arguments={
"method": "GET",
"url": "https://api.github.com/users/octocat"
}
)

print(f"Status: {response['status_code']}")
print(f"User: {response['body']['name']}")
// TypeScript - GET with query parameters
const response = await client.callTool({
name: "HTTPS_Call",
arguments: {
method: "GET",
url: "https://api.example.com/search",
params: {
q: "machine learning",
limit: 10
}
}
});
// URL becomes: https://api.example.com/search?q=machine+learning&limit=10

POST Request with JSON

# Python - POST JSON data
response = client.call_tool(
name="HTTPS_Call",
arguments={
"method": "POST",
"url": "https://api.example.com/users",
"json": {
"name": "John Doe",
"email": "john@example.com",
"role": "developer"
},
"headers": {
"Authorization": "Bearer sk-abc123xyz"
}
}
)

if response["success"]:
print(f"Created user: {response['body']['id']}")
// TypeScript - POST with authentication
const response = await client.callTool({
name: "HTTPS_Call",
arguments: {
method: "POST",
url: "https://api.service.com/v1/items",
json: {
title: "New Item",
description: "Item description"
},
headers: {
"Authorization": "API-Key your-api-key-here",
"X-Custom-Header": "value"
}
}
});

PUT Request

# Python - Update resource
response = client.call_tool(
name="HTTPS_Call",
arguments={
"method": "PUT",
"url": "https://api.example.com/users/123",
"json": {
"name": "Updated Name",
"email": "newemail@example.com"
}
}
)

DELETE Request

# Python - Delete resource
response = client.call_tool(
name="HTTPS_Call",
arguments={
"method": "DELETE",
"url": "https://api.example.com/users/123",
"headers": {
"Authorization": "Bearer token"
}
}
)

if response["status_code"] == 204:
print("Successfully deleted")

Form Data Submission

# Python - Submit form data
response = client.call_tool(
name="HTTPS_Call",
arguments={
"method": "POST",
"url": "https://example.com/contact",
"data": {
"name": "John Doe",
"email": "john@example.com",
"message": "Hello!"
}
}
)

Common Patterns

API Key Authentication

# Most APIs use headers for authentication
response = client.call_tool(
name="HTTPS_Call",
arguments={
"method": "GET",
"url": "https://api.service.com/data",
"headers": {
"Authorization": "Bearer YOUR_API_KEY",
# or
"X-API-Key": "YOUR_API_KEY",
# or
"Api-Key": "YOUR_API_KEY"
}
}
)

Pagination Handling

# Fetch paginated results
def fetch_all_pages(base_url, headers):
all_results = []
page = 1

while True:
response = client.call_tool(
name="HTTPS_Call",
arguments={
"method": "GET",
"url": base_url,
"params": {"page": page, "per_page": 100},
"headers": headers
}
)

if not response["body"]["results"]:
break

all_results.extend(response["body"]["results"])
page += 1

return all_results

Error Handling

# Robust error handling
response = client.call_tool(
name="HTTPS_Call",
arguments={
"method": "GET",
"url": "https://api.example.com/data",
"timeout": 10
}
)

if response["status_code"] == 200:
print("Success:", response["body"])
elif response["status_code"] == 404:
print("Not found")
elif response["status_code"] == 401:
print("Unauthorized - check API key")
elif response["status_code"] >= 500:
print("Server error - try again later")
else:
print(f"Error: {response['status_code']}")

Webhook Triggers

# Trigger webhook
response = client.call_tool(
name="HTTPS_Call",
arguments={
"method": "POST",
"url": "https://hooks.example.com/webhook/abc123",
"json": {
"event": "user_signup",
"user_id": "12345",
"timestamp": "2025-11-22T10:30:00Z"
}
}
)

Authentication Patterns

Bearer Token

{
"headers": {
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}

API Key in Header

{
"headers": {
"X-API-Key": "your_api_key_here"
}
}

Basic Auth

import base64

# Encode username:password
credentials = base64.b64encode(b"username:password").decode("utf-8")

{
"headers": {
"Authorization": f"Basic {credentials}"
}
}

Query Parameter Auth

{
"params": {
"api_key": "your_api_key_here"
}
}

Best Practices

Security

  • Never hardcode API keys in code
  • Store credentials in environment variables or custom tool overrides
  • Use HTTPS (not HTTP) for sensitive data
  • Rotate API keys regularly

Performance

  • Set appropriate timeouts for long-running requests
  • Use connection pooling for multiple requests (handled automatically)
  • Cache responses when appropriate
  • Implement retry logic for transient failures

Headers

  • Set User-Agent for better API compatibility
  • Include Accept header to specify response format
  • Use Content-Type appropriately (auto-set for JSON)

Error Handling

  • Check status_code before using response body
  • Handle rate limiting (429 status)
  • Implement exponential backoff for retries
  • Log errors for debugging

Integration Examples

Example 1: Custom CRM Integration

# Add contact to custom CRM
def add_crm_contact(name, email, company):
response = client.call_tool(
name="HTTPS_Call",
arguments={
"method": "POST",
"url": "https://api.mycrm.com/v1/contacts",
"json": {
"name": name,
"email": email,
"company": company,
"source": "AI Agent"
},
"headers": {
"Authorization": f"Bearer {CRM_API_KEY}",
"Content-Type": "application/json"
}
}
)

if response["status_code"] == 201:
return response["body"]["id"]
else:
raise Exception(f"Failed to create contact: {response['status_code']}")

Example 2: Slack Notification

# Send message to Slack
def notify_slack(channel, message):
response = client.call_tool(
name="HTTPS_Call",
arguments={
"method": "POST",
"url": "https://slack.com/api/chat.postMessage",
"json": {
"channel": channel,
"text": message
},
"headers": {
"Authorization": f"Bearer {SLACK_BOT_TOKEN}",
"Content-Type": "application/json"
}
}
)

return response["body"]["ok"]

Example 3: Data Pipeline

# Fetch data from API and store in Supabase
def sync_external_data():
# Fetch from external API
api_response = client.call_tool(
name="HTTPS_Call",
arguments={
"method": "GET",
"url": "https://api.external.com/data",
"headers": {"Authorization": f"API-Key {EXTERNAL_API_KEY}"}
}
)

# Transform data
records = [
{
"id": item["id"],
"name": item["name"],
"synced_at": datetime.now().isoformat()
}
for item in api_response["body"]["items"]
]

# Store in Supabase
supabase.call_tool(
name="supabase_create_records",
arguments={
"table": "external_data",
"records": records
}
)

Troubleshooting

"Timeout" Error

Cause: Request took longer than timeout value

Solutions:

  • Increase timeout parameter
  • Check if API endpoint is responsive
  • Verify network connectivity
  • Consider breaking into smaller requests

"SSL Certificate Verification Failed"

Cause: Invalid or self-signed SSL certificate

Solutions:

  • Verify URL is correct
  • Check if certificate is expired
  • For development only: some tools allow skipping verification (not recommended for production)

"Connection Refused"

Cause: Cannot connect to server

Solutions:

  • Verify URL is correct and accessible
  • Check firewall settings
  • Ensure service is running
  • Try from different network

Rate Limiting (429)

Cause: Too many requests to API

Solutions:

  • Implement exponential backoff
  • Reduce request frequency
  • Check API documentation for rate limits
  • Use caching to reduce requests

See Also