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/image-url.jpg%20%22Optional%20title%22?q=api&page=1&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 11547 results for "api"(1267ms)

blog2025-04-08-migration.md1 match

@filUpdated 32 mins ago
83We didn't. We left them where they are, and proxy to them.
84
85Writing a proxy in Val Town (or any functions platform with the ['fetch handler' interface](https://blog.val.town/blog/the-api-we-forgot-to-name/)) is a delight:
86
87```ts

bloglive-reload.ts1 match

@filUpdated 33 mins ago
82 // if we wanted to create a /lastUpdatedAt route,
83 // which would let us pass a val town bearer token, we could do that here
84 // gives us 10k API requests per minute instead of 1k
85 // and would work with private projects
86

blogget-old-posts.ts25 matches

@filUpdated 33 mins ago
19export const oldPosts: BlogPost[] = [
20 {
21 "title": "Solving the internal / external API riddle",
22 "slug": "api-conundrum",
23 "link": "/blog/api-conundrum",
24 "description": "Figuring out how to provide an API that's usable by everyone and fast for us to iterate on",
25 "pubDate": "Thu, 27 Mar 2025 00:00:00 GMT",
26 "author": "Tom MacWright",
27 },
28 {
29 "title": "API Tokens Scopes",
30 "slug": "api-token-scopes",
31 "link": "/blog/api-token-scopes",
32 "description": "Improving security with granular control over permissions",
33 "pubDate": "Fri, 01 Nov 2024 00:00:00 GMT",
59 },
60 {
61 "title": "Expanding the Vals API - RFC",
62 "slug": "expanding-the-vals-api-rfc",
63 "link": "/blog/expanding-the-vals-api-rfc",
64 "description": "Our REST API lets you do a lot - and soon it will enable more",
65 "pubDate": "Fri, 30 Jun 2023 00:00:00 GMT",
66 "author": "André Terron",
133 },
134 {
135 "title": "The perks of a good OpenAPI spec",
136 "slug": "openapi",
137 "link": "/blog/openapi",
138 "description": "Taking advantage of our typed REST API to build a platform around\nVal Town.",
139 "pubDate": "Thu, 25 Jul 2024 00:00:00 GMT",
140 "author": "Tom MacWright",
262 },
263 {
264 "title": "The API we forgot to name",
265 "slug": "the-api-we-forgot-to-name",
266 "link": "/blog/the-api-we-forgot-to-name",
267 "description": "An API that takes a Request and returns a Response - what was that, again?",
268 "pubDate": "Thu, 19 Oct 2023 00:00:00 GMT",
269 "author": "Steve Krouse",
286 },
287 {
288 "title": "Deprecating the Run API",
289 "slug": "deprecating-the-run-api",
290 "link": "/blog/deprecating-the-run-api",
291 "description": "Not every function should be an API",
292 "pubDate": "Wed, 07 Feb 2024 00:00:00 GMT",
293 "author": "André Terron",
321 "slug": "val-town-newsletter-1",
322 "link": "/blog/val-town-newsletter-1",
323 "description": "Programmatic notifications, Hacker News API, and more.",
324 "pubDate": "Wed, 04 Jan 2023 00:00:00 GMT",
325 "author": "Steve Krouse",
450 "slug": "val-town-newsletter-22",
451 "link": "/blog/val-town-newsletter-22",
452 "description": "Townie upgrades, Scoped API permissions, Fal partnership",
453 "pubDate": "Mon, 02 Dec 2024 00:00:00 GMT",
454 "author": "Steve Krouse",

blog2025-04-23-upgrading.md9 matches

@filUpdated 33 mins ago
8Today, we’re unifying our two primitives — *vals* and *projects* — into a single primitive: the **val**, with the best features of both.
9
10Historically, vals have been simple and lightweight, but limited to a single file. This upgrade will preserve the elegant spirit of our platform while supporting more complex code and collaborative workflows. This upgrade will help you create bigger things on Val Town – APIs, internal tools, fullstack apps, blogs ([like this one](https://www.val.town/x/valdottown/blog)), and much more – without sacrificing the simplicity you've always loved about vals.
11
12*Legacy vals* will temporarily become *projects* during this migration. Post-migration, the concept of *projects* will disappear entirely — leaving only upgraded *vals*. In short: *legacy vals* → *projects* → *vals*.
16For most users, no upgrade action is required. We’ll auto-migrate your vals next week. All existing HTTP endpoints, crons, email handlers, and custom domains will be preserved.
17
18For those with mission-critical vals or who use our API to edit or create vals, you can start upgrading your legacy vals today and integrating with our updated API.
19
20- **April 23, 2025** – Announcement of changes & API deprecations.
21- **April 30, 2025** – All remaining *legacy vals* auto-upgraded. Deprecated API routes become read-only.
22- **May 1, 2025** – The term *projects* will no longer exist — everything will simply be a *val*.
23
35[See more details in our docs.](https://docs.val.town/upgrading/legacy-vals)
36
37## API Changes
38
39Today, we're introducing the following API routes:
40
41```bash
73```
74
75View our [updated API reference here](https://docs.val.town/openapi).
76
77All `v1/vals` API routes become read-only on **April 30, 2025**. If you rely on *writing* to those routes, please upgrade to our new `v2/vals` API. All deprecated API routes will continue serving historical legacy val data.
78
79### SDK changes
85
861. Upgrade your mission-critical vals early.
872. Update your Val Town API & SDK usage to `/v2` routes.
883. All remaining legacy vals migrate on **April 30, 2025**.
894. Migration completes on **May 1, 2025**.

whatsapp-callbackindex.tsx5 matches

@yawnxyzUpdated 42 mins ago
6// Retrieve environment variables
7const WHATSAPP_WEBHOOK_VERIFY_TOKEN = Deno.env.get("WHATSAPP_WEBHOOK_VERIFY_TOKEN");
8const WHATSAPP_GRAPH_API_TOKEN = Deno.env.get("WHATSAPP_GRAPH_API_TOKEN");
9
10app.post("/webhook", async (c) => {
21 console.log("Message from:", message.from, "Message text:", message.text.body);
22
23 if (WHATSAPP_GRAPH_API_TOKEN && business_phone_number_id) {
24 // Send a reply message
25 try {
29 method: "POST",
30 headers: {
31 "Authorization": `Bearer ${WHATSAPP_GRAPH_API_TOKEN}`,
32 "Content-Type": "application/json",
33 },
49 method: "POST",
50 headers: {
51 "Authorization": `Bearer ${WHATSAPP_GRAPH_API_TOKEN}`,
52 "Content-Type": "application/json",
53 },
65 }
66 } else {
67 console.error("WHATSAPP_GRAPH_API_TOKEN or business_phone_number_id is missing.");
68 }
69 }

TownieuseProject.tsx2 matches

@charmaineUpdated 46 mins ago
2import { useAuth } from "./useAuth.tsx";
3
4const PROJECT_ENDPOINT = "/api/project";
5const FILES_ENDPOINT = "/api/project-files";
6
7export function useProject (projectId: string, branchId?: string) {

TownieuseProjects.tsx1 match

@charmaineUpdated 46 mins ago
2import { useAuth } from "./useAuth.tsx";
3
4const ENDPOINT = "/api/projects-loader";
5
6export function useProjects () {

TownieuseCreateProject.tsx1 match

@charmaineUpdated 46 mins ago
3import { useAuth } from "./useAuth.tsx";
4
5const ENDPOINT = "/api/create-project";
6
7export function useCreateProject () {

TownieuseCreateBranch.tsx1 match

@charmaineUpdated 46 mins ago
2import { useAuth } from "./useAuth.tsx";
3
4const ENDPOINT = "/api/create-branch";
5
6export function useCreateBranch (projectId: string) {

TownieuseChatLogic.ts4 matches

@charmaineUpdated 46 mins ago
6 project: any;
7 branchId: string | undefined;
8 anthropicApiKey: string;
9 bearerToken: string;
10 selectedFiles: string[];
16 project,
17 branchId,
18 anthropicApiKey,
19 bearerToken,
20 selectedFiles,
37 status,
38 } = useChat({
39 api: "/api/send-message",
40 body: {
41 project,
42 branchId,
43 anthropicApiKey,
44 selectedFiles,
45 images: images

gptApiTemplate2 file matches

@charmaineUpdated 1 day ago

mod-interview-api1 file match

@twschillerUpdated 1 day ago
papimark21
socialdata
Affordable & reliable alternative to Twitter API: ➡️ Access user profiles, tweets, followers & timeline data in real-time ➡️ Monitor profiles with nearly instant alerts for new tweets, follows & profile updates ➡️ Simple integration