• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
sunnyatlightswitch

sunnyatlightswitch

send-transcripts

Public
Like
send-transcripts
Home
Code
2
README.md
H
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
6/21/2025
Viewing readonly version of main branch: v4
View latest version
README.md

Text Storage API

A simple API endpoint that receives text and saves it to a SQLite database.

Features

  • Save text entries to a SQLite database
  • Retrieve all text entries
  • Retrieve specific text entries by ID
  • Automatic timestamps for entries
  • Input validation and error handling

API Endpoints

POST /api/text

Save a new text entry.

Request Body:

{ "text": "Your text content here" }

Response:

{ "success": true, "id": 1, "message": "Text saved successfully" }

GET /api/text

Retrieve all text entries (ordered by most recent first).

Response:

{ "success": true, "data": [ { "id": 1, "text": "Your text content", "created_at": "2024-01-01 12:00:00" } ] }

GET /api/text/:id

Retrieve a specific text entry by ID.

Response:

{ "success": true, "data": { "id": 1, "text": "Your text content", "created_at": "2024-01-01 12:00:00" } }

Database Schema

The API uses a SQLite table with the following structure:

CREATE TABLE text_entries ( id INTEGER PRIMARY KEY AUTOINCREMENT, text TEXT NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP );

Usage Examples

Save text using curl:

curl -X POST https://your-val-url/api/text \ -H "Content-Type: application/json" \ -d '{"text": "Hello, world!"}'

Get all entries:

curl https://your-val-url/api/text

Get specific entry:

curl https://your-val-url/api/text/1

Error Handling

The API returns appropriate HTTP status codes:

  • 200: Success
  • 400: Bad request (missing or invalid text)
  • 404: Text entry not found
  • 500: Server error

All error responses include an error field with a descriptive message.

FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.