Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/?q=api&page=404&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 4131 results for "api"(467ms)

BraintrustSDKREADME.md2 matches

@charmaine•Updated 2 months ago
12
13- Click `Fork` on this val
14- Get your Braintrust API key at https://www.braintrust.dev/app/settings?subroute=api-keys
15- Add it to your project `Environment Variables` (on the left side bar of this project) as `BRAINTRUST_API_KEY`
16- Click `Run` on the `tutorial` val

Windsurfprojectcontext5 matches

@toowired•Updated 2 months ago
3import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
4
5// API Documentation
6/**
7 * @typedef {Object} ProjectState
61 setError(null);
62 try {
63 const response = await fetch("/api/state");
64 if (!response.ok) throw new Error("Failed to fetch state");
65 const data = await response.json();
80 setError(null);
81 try {
82 const response = await fetch("/api/state", {
83 method: "POST",
84 headers: { "Content-Type": "application/json" },
579 await authenticate(req);
580
581 if (req.method === "GET" && req.url.endsWith("/api/state")) {
582 const state = await getState();
583 return Response.json(state || {});
584 } else if (req.method === "POST" && req.url.endsWith("/api/state")) {
585 const update = await req.json();
586 validateInput(update);

blueskyBotTutorialblueskyPost1 match

@charmaine•Updated 2 months ago
1import { BskyAgent } from "npm:@atproto/api";
2
3export async function postToBluesky() {

BraintrustSDKtutorial7 matches

@charmaine•Updated 2 months ago
5export default async function handler() {
6 const result = {
7 apiKeyStatus: null,
8 evalStarted: false,
9 evalComplete: false,
13
14 try {
15 // Check API key
16 const apiKey = Deno.env.get("BRAINTRUST_API_KEY");
17 if (!apiKey) {
18 throw new Error("Add BRAINTRUST_API_KEY to your environment variables");
19 }
20 result.apiKeyStatus = "found";
21 console.log("API Key status:", result.apiKeyStatus);
22
23 // Start evaluation

APIBuilderTemplateblissfulSapphireFly1 match

@dcm31•Updated 2 months ago
1export default function handler(req: Request) {
2 return new Response("Hello, Val Town API!", {
3 headers: {
4 "Content-Type": "text/plain"

APIBuilderTemplatehumblePeachCobra1 match

@dcm31•Updated 2 months ago
2
3http.get("/hello", (req, res) => {
4 res.send("Hello, Val Town API!");
5});

blob_admin_migratedmain.tsx25 matches

@shouser•Updated 2 months ago
73 const menuRef = useRef(null);
74 const isPublic = blob.key.startsWith("__public/");
75 const publicUrl = isPublic ? `${window.location.origin}/api/public/${encodeURIComponent(blob.key.slice(9))}` : null;
76
77 useEffect(() => {
237 setLoading(true);
238 try {
239 const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
240 const data = await response.json();
241 setBlobs(data);
264 setBlobContentLoading(true);
265 try {
266 const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
267 const content = await response.text();
268 setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
278 const handleSave = async () => {
279 try {
280 await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
281 method: "PUT",
282 body: editContent,
290 const handleDelete = async (key) => {
291 try {
292 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
293 setBlobs(blobs.filter(b => b.key !== key));
294 if (selectedBlob && selectedBlob.key === key) {
307 const key = `${searchPrefix}${file.name}`;
308 formData.append("key", encodeKey(key));
309 await fetch("/api/blob", { method: "POST", body: formData });
310 const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
311 setBlobs([newBlob, ...blobs]);
329 try {
330 const fullKey = `${searchPrefix}${key}`;
331 await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
332 method: "PUT",
333 body: "",
344 const handleDownload = async (key) => {
345 try {
346 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
347 const blob = await response.blob();
348 const url = window.URL.createObjectURL(blob);
363 if (newKey && newKey !== oldKey) {
364 try {
365 const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
366 const content = await response.blob();
367 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
368 method: "PUT",
369 body: content,
370 });
371 await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
372 setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
373 if (selectedBlob && selectedBlob.key === oldKey) {
383 const newKey = `__public/${key}`;
384 try {
385 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
386 const content = await response.blob();
387 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
388 method: "PUT",
389 body: content,
390 });
391 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
392 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
393 if (selectedBlob && selectedBlob.key === key) {
402 const newKey = key.slice(9); // Remove "__public/" prefix
403 try {
404 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
405 const content = await response.blob();
406 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
407 method: "PUT",
408 body: content,
409 });
410 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
411 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
412 if (selectedBlob && selectedBlob.key === key) {
557 onClick={() =>
558 copyToClipboard(
559 `${window.location.origin}/api/public/${encodeURIComponent(selectedBlob.key.slice(9))}`,
560 )}
561 className="text-blue-400 hover:text-blue-300 text-sm"
580 >
581 <img
582 src={`/api/blob?key=${encodeKey(selectedBlob.key)}`}
583 alt="Blob content"
584 className="max-w-full h-auto"
660
661// Public route without authentication
662app.get("/api/public/:id", async (c) => {
663 const key = `__public/${c.req.param("id")}`;
664 const { blob } = await import("https://esm.town/v/std/blob");
766};
767
768app.get("/api/blobs", checkAuth, async (c) => {
769 const prefix = c.req.query("prefix") || "";
770 const limit = parseInt(c.req.query("limit") || "20", 10);
775});
776
777app.get("/api/blob", checkAuth, async (c) => {
778 const key = c.req.query("key");
779 if (!key) return c.text("Missing key parameter", 400);
783});
784
785app.put("/api/blob", checkAuth, async (c) => {
786 const key = c.req.query("key");
787 if (!key) return c.text("Missing key parameter", 400);
792});
793
794app.delete("/api/blob", checkAuth, async (c) => {
795 const key = c.req.query("key");
796 if (!key) return c.text("Missing key parameter", 400);
800});
801
802app.post("/api/blob", checkAuth, async (c) => {
803 const { file, key } = await c.req.parseBody();
804 if (!file || !key) return c.text("Missing file or key", 400);

sqliteExplorerAppREADME.md1 match

@shouser•Updated 2 months ago
13## Authentication
14
15Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
16
17## Todos / Plans

sqliteExplorerAppmain.tsx2 matches

@shouser•Updated 2 months ago
27 <head>
28 <title>SQLite Explorer</title>
29 <link rel="preconnect" href="https://fonts.googleapis.com" />
30
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link
33 href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34 rel="stylesheet"
35 />

OpenTownieREADME.md3 matches

@AIWB•Updated 2 months ago
10## Getting Started
11
121. Create a [Val Town API token](https://www.val.town/settings/api) with Val read and write permissions
132. Paste the token into the input box and get started
14
15## Forking the Project
16
17You'll need to get an **Open Router API key**.
18We choose Open Router so we could easily switch between
19all models. We soon want to make it so you can choose your
20model from a dropdown, but we're having trouble formatting the api calls such that they work on all providers. Maybe we need to switch to the vercel sdk

openapi2 file matches

@stevekrouse•Updated 1 day ago

dbToAPI_backup4 file matches

@nbbaier•Updated 3 days ago
artivilla
founder @outapint.io vibe coding on val.town. dm me to build custom vals: https://artivilla.com
fiberplane
Purveyors of Hono tooling, API Playground enthusiasts, and creators of 🪿 HONC 🪿 (https://honc.dev)