• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
ianmenethil

ianmenethil

ZenServer

Unlisted
Like
ZenServer
Home
Code
21
.claude
.client
.cursor
.git
.vscode
.vt
scripts
5
src
10
tasks
.gitignore
.vtignore
AGENTS.md
CLAUDE.md
PLAN.md
PROJECT_MAPPING.MD
Z1-Server.md
ZenApp.md
deno.json
env.example
H
main.ts
map.md
Branches
1
Pull requests
Remixes
History
Environment variables
22
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
/
scripts
/
README.md
Code
/
scripts
/
README.md
Search
7/9/2025
Viewing readonly version of main branch: v643
View latest version
README.md

OpenAPI Sync Scripts

Automatically sync your local openapi.json file to Val Town blob storage.

πŸ”§ Setup

1. Get Your Val Town API Token

  1. Go to https://val.town/settings/api
  2. Create a new API token
  3. Copy the token value

2. Set Environment Variable

Windows (PowerShell):

$env:VALTOWN_API_TOKEN = "your_token_here"

Windows (Command Prompt):

set VALTOWN_API_TOKEN=your_token_here

Permanent (Windows):

[Environment]::SetEnvironmentVariable("VALTOWN_API_TOKEN", "your_token_here", "User")

πŸš€ Usage

Option 1: Batch File (Easiest)

cd ZenServer\scripts sync-openapi.bat

Option 2: PowerShell

cd ZenServer\scripts .\sync-openapi-to-valtown.ps1

Option 3: Deno (Cross-platform)

cd ZenServer\scripts deno run -A sync-openapi-to-valtown.ts

πŸ“ What It Does

  • Source: F:\val.town\ZenServer\openapi.json
  • Destination: __public/ZPServer/openapi.json in Val Town blob storage
  • Action: Creates or overwrites the blob automatically
  • Verification: Reads back the uploaded content to verify success

🌐 Public Access

After upload, your OpenAPI spec will be available at:

https://api.val.town/v1/blob/__public%2FZPServer%2Fopenapi.json

πŸ”’ Security

  • API token is read from environment variable (not stored in scripts)
  • Uses HTTPS for all API calls
  • Validates JSON before upload
  • Verifies upload integrity

πŸ› οΈ Customization

You can modify the file paths by editing the script variables:

PowerShell:

.\sync-openapi-to-valtown.ps1 -LocalFile "C:\custom\path\openapi.json" -BlobKey "custom/key"

Deno: Edit the constants at the top of sync-openapi-to-valtown.ts

πŸ› Troubleshooting

"API token required" error:

  • Make sure VALTOWN_API_TOKEN environment variable is set
  • Restart your terminal after setting the variable

"File not found" error:

  • Check that F:\val.town\ZenServer\openapi.json exists
  • Verify the file path in the script matches your setup

"Invalid JSON" error:

  • Validate your JSON file with a JSON validator
  • Check for syntax errors in the OpenAPI spec

Permission errors:

  • Run PowerShell as Administrator if needed
  • Check that the file is not locked by another application
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
Β© 2026 Val Town, Inc.