Quickstart: Build a Social Media Post Generator as a REST API
Quickstart: Build a Social Media Post Generator as a REST API
This quickstart shows you how to build a simple Flow, package it in a Product, and make it available through a REST API Surface from the Runtype dashboard.
New to these concepts? Start with What are Flows?, What are Products?, and What are Surfaces?.
What you’ll build
You’ll create a Flow that turns website content into social media posts, then deploy it as a live REST API endpoint you can call from any application.
Step 1: Create a Flow
You’ll build a Flow with two steps: one to fetch website content and one to generate social posts from it.
- From the dashboard, click Flows in the sidebar.
- Click Create Flow.
- Select Start from scratch.
- Click the + button to add your first step.
- Select Fetch URL as the step type.
- Configure the step to use Firecrawl (Web Scraping).
- In the URL field, enter
{{website}}. This creates a variable you’ll fill in each time you run the Flow. - Click the + button to add a second step, then select Run Task. This is where you’ll write the AI prompt that processes the fetched content. To learn more, see creating and editing Flows.
- Paste the following into the User instructions field:
- Name your Flow Website Content to Social Media Content.
- Click Create.
The double-curly-brace syntax ({{variable}}) lets you pass dynamic values into your Flow. Any step can reference variables set by earlier steps. Here, {{fetch_result}} contains the output from the Fetch URL step.
Step 2: Test your Flow
Before deploying, make sure the Flow works as expected.
- Click Run on your Flow.
- Enter a URL such as https://runtype.com for the website field.
- Click Run Flow.
- Review the response and confirm it includes posts for Twitter, LinkedIn, and Instagram.
If the output does not look right, go back and adjust the prompt in the Run Task step. You can iterate as many times as you need.
Step 3: Create a Product and Surface
A Product groups your Flows and Agents for deployment. Each Product has one or more Surfaces that people or applications use to interact with your Capabilities, and one or more Capabilities that are powered by your Flows or Agents.
- Click Products in the sidebar.
- Click + New Product.
- Select REST API as the Surface type.
- Enter a name for the Product, such as Social Media Post Generator.
- Under the Capability option, choose Use Existing, then select Flows.
- Find and select the Flow you created earlier: Website Content to Social Media Content.
- Click Create.
Runtype creates a Product with your Flow attached as a Capability and a REST API Surface ready to accept requests.
Step 4: Call your endpoint
Your Surface is live. Open your new Product to find the endpoint URL and API key.
curl
TypeScript
Replace YOUR_PRODUCT_ID, YOUR_SURFACE_ID, and YOUR_SURFACE_API_KEY with the values shown on your Product page. The capability value is the name of the Capability you attached (the Flow name, Website Content to Social Media Content), and input holds the Flow’s input variables.
You now have a working REST API that turns any article into social media content, ready to integrate into your app, CMS, or automation workflow.
Next steps
- Flow step types overview to build more advanced Flows
- What are Tools? to understand how Flows and Agents can call external systems and built-in capabilities
- What are Logs? to troubleshoot executions
- Creating and managing Records to add structured context to your Flows
- What are Evals? to compare prompts and models side by side