---
title: "RCP Call"
url: "https://help.flows.world/en/article/rcp-call"
language: "en"
last_updated: "2025-12-12T15:16:02.540Z"
---

# RCP Call

The RPC Call stage allows you to call Supabase stored functions (RPC) with parameters. This is useful for complex queries like aggregations, joins, or custom logic that can't be done with simple CRUD operations.

**Input Parameters**

| **Parameter** | **Variable** | **Required** | **Description** |
| --- | --- | --- | --- |
| Function Name | {{functionName}} | Yes | Name of the RPC function to call |
| Body Payload | {{bodyPayload}} | Yes | JSON string with function parameters |

  
 

**Output**

| **Output** | **Variable** | **Description** |
| --- | --- | --- |
| RPC Result | {{rpcResult}} | Result returned by the function |
| Success | {{success}} | Boolean indicating if the call succeeded |

  
 

**Creating RPC Functions**

**Before using the RPC Call stage, you need to create functions in Supabase. Here are some examples:**

  
 

**Example 1: Get Records in Multiple Categories**

**Find IDs that exist in ALL specified categories:**

**CREATE OR REPLACE FUNCTION get\_items\_in\_all\_categories(category\_ids int\[\])**

**RETURNS TABLE(item\_id bigint) AS $$**

**BEGIN**

  **RETURN QUERY**

  **SELECT i.item\_id FROM items i**

  **WHERE i.category\_id = ANY(category\_ids)**

  **GROUP BY i.item\_id**

  **HAVING COUNT(DISTINCT i.category\_id) = array\_length(category\_ids, 1);**

**END;**

**$$ LANGUAGE plpgsql;**

  
 

**Example 2: Get Categories by Item ID**

**Find all categories for a specific item:**

**CREATE OR REPLACE FUNCTION get\_categories\_by\_item(item\_id\_input bigint)**

**RETURNS TABLE(category\_id bigint) AS $$**

**BEGIN**

  **RETURN QUERY**

  **SELECT i.category\_id::bigint FROM items i**

  **WHERE i.item\_id = item\_id\_input;**

**END;**

**$$ LANGUAGE plpgsql;**

  
 

**Usage Examples**

**Example 1: Find Items in Multiple Categories**

| **Parameter** | **Value** |
| --- | --- |
| functionName | get\_items\_in\_all\_categories |
| bodyPayload | "{\\"category\_ids\\": \[1, 2, 3\]}" |

**Result: Returns all item\_ids that exist in ALL three categories**

  
 

**Example 2: Get Categories for an Item**

| **Parameter** | **Value** |
| --- | --- |
| functionName | get\_categories\_by\_item |
| bodyPayload | "{\\"item\_id\_input\\": 123}" |

**Result: Returns all category IDs associated with item 123**

  
 

**Important Notes**

-   Functions must be created in Supabase SQL Editor first
-   Use bigint for IDs to avoid type mismatch errors
-   Parameter names in bodyPayload must match function parameter names exactly
-   Great for complex queries: aggregations, joins, intersections
