RAP Logo

http in

Receive HTTP requests and start workflows from external systems

http in Block

The http in block is used to receive HTTP requests and start workflows from external systems. It creates an HTTP endpoint that can be called from web applications, APIs, or other services to trigger your RAPFlow workflows.

Overview

The http in block acts as the entry point for creating REST API endpoints with your RAPFlow workflows. When combined with an http response block, it allows you to build complete API services that can process documents, run AI models, and return results.

Configuration Options

HTTP Method

  • GET: Retrieve data or trigger read-only operations
  • POST: Send data for processing (most common for document workflows)
  • PUT: Update existing resources
  • DELETE: Remove resources
  • PATCH: Partial updates

URL Path

  • URL: The endpoint path (e.g., /api/process-document)
  • URL Parameters: Access parameters via msg.req.params
  • Query Parameters: Access via msg.req.query

Request Handling

  • Accept file uploads: Enable to handle multipart form data
  • Parse body: Automatically parse JSON, form data, or raw content
  • CORS: Configure Cross-Origin Resource Sharing if needed

Message Properties

The http in block creates a message object with the following properties:

{
    payload: /* request body content */,
    req: {
        params: /* URL parameters */,
        query: /* query string parameters */,
        headers: /* HTTP headers */,
        files: /* uploaded files (if file upload enabled) */,
        body: /* raw request body */,
        method: /* HTTP method */,
        url: /* request URL */
    },
    res: /* response object for http response block */
}

Common Use Cases

Document Processing API

Create an endpoint to process uploaded documents:

http in (POST /api/process) → OCR → Document Classifier → http response

File Upload Endpoint

Handle file uploads for processing:

{
  "method": "POST",
  "url": "/api/upload",
  "accept_file_uploads": true
}

Query API

Create a query endpoint for document Q&A:

http in (POST /api/query) → Document Question Answering → http response

Webhook Receiver

Receive webhooks from external systems:

{
  "method": "POST",
  "url": "/api/webhook",
  "parse_body": true
}

Best Practices

  1. Always pair with http response: Every http in block should connect to an http response block
  2. Validate input data: Use validation blocks before processing
  3. Handle errors gracefully: Use catch blocks to handle errors and return appropriate responses
  4. Set appropriate paths: Use descriptive, RESTful URL paths
  5. Enable CORS if needed: Configure CORS for browser-based applications

Common Flow Patterns

Basic API Endpoint

http in → [processing blocks] → http response

File Processing Service

http in → Extract Archive → PDF Processor → OCR → http response

AI Document Analysis

http in → Pre Process Document → Document Classifier → LLM Query → http response

Error Handling Pattern

http in → [processing] → http response

      catch → http response (error)

Tips

  • Test your endpoints using tools like Postman or curl
  • Check the debug panel to see the structure of incoming requests
  • Use the msg.req.files property to access uploaded files
  • Set appropriate HTTP status codes in your http response block
  • Consider rate limiting for production deployments

Deployment

After creating your flow with http in and http response blocks:

  1. Save your flow: Ensure all connections are properly made
  2. Navigate to Flow AI tab: Click on the "Flow AI" card in your project
  3. Click Deploy: Deploy your flow to make the endpoint available
  4. Test the endpoint: Use the generated URL to test your API

Need help with HTTP configuration? Check the http response documentation for completing your API endpoints.