Signpost AI Logo
WorkersInput output

Api

📸 Screenshots

Here are visual examples of this section:

Api - Worker Configuration Interface Api - Worker Configuration Interface

1. Overview and Purpose

The API worker enables integration with external services by making HTTP requests to various endpoints. It supports multiple HTTP methods, authentication types, and flexible parameter configuration. This worker is marked as deprecated but remains functional for existing workflows.

2. Configuration Parameters

  • endpoint: Fallback API endpoint URL when no runtime endpoint is provided
  • method: HTTP method for the request (GET, POST, PUT, DELETE, etc.)
  • params: JSON string containing query parameters to append to the URL
  • headers: JSON string containing HTTP headers to include in the request
  • timeout: Request timeout in milliseconds (default: 10000)
  • authType: Authentication method - 'none', 'basic', or 'bearer'
  • username: Username for basic authentication
  • selectedKeyName: Name of the stored API key to use for authentication

3. Input/Output Handles

  • body: Input handle - accepts request body data for POST/PUT requests
  • endpointUrlInput: Input handle - accepts runtime endpoint URL that overrides parameter endpoint
  • response: Output handle - returns successful API response data
  • error: Output handle - returns error messages when requests fail

4. Usage Examples with Code

// Configure API worker for a REST endpoint
{
  endpoint: "https://api.example.com/users",
  method: "POST",
  headers: '{"Content-Type": "application/json"}',
  params: '{"limit": 10}',
  authType: "bearer",
  selectedKeyName: "MY_API_KEY"
}

// Body input (for POST/PUT requests)
{
  "name": "John Doe",
  "email": "john@example.com"
}

5. Integration Examples

This worker serves as a bridge between Signpost AI workflows and external APIs, enabling data fetching, webhook calls, and service integrations. It can be chained with other workers to process API responses or trigger actions based on external data.

6. Best Practices

  • Use the endpointUrlInput handle for dynamic endpoints rather than hardcoding in parameters
  • Store sensitive API keys in environment variables and reference them via selectedKeyName
  • Set appropriate timeout values based on expected API response times
  • Handle both success and error outputs in your workflow logic

7. Troubleshooting Tips

  • Check that the endpoint URL is properly formatted and accessible
  • Verify authentication credentials are correctly configured in environment variables
  • Ensure JSON parameters and headers are valid JSON strings
  • Monitor timeout settings for slow APIs and adjust accordingly