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=185&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 15186 results for "api"(2319ms)

my-blogget-old-posts.ts25 matches

@iamvikeshtiwariβ€’Updated 1 week 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",

my-blog2025-04-23-upgrading.md9 matches

@iamvikeshtiwariβ€’Updated 1 week 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**.

my-blog2025-04-08-migration.md1 match

@iamvikeshtiwariβ€’Updated 1 week 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

e-comm-testCartItem.jsx2 matches

@charleswebmasterβ€’Updated 1 week ago
4import { useState } from "react";
5import { Button, Card, Form } from "react-bootstrap";
6import { api } from "../api";
7
8const CartItem = ({ item, onUpdate }) => {
11 const handleRemove = async () => {
12 try {
13 await api.delete(`/customer/cart/remove/${item.product._id}`);
14 onUpdate();
15 } catch (error) {

untitled-1573index.ts1 match

@Shantanu_143β€’Updated 1 week ago
20
21// Get weather data endpoint
22app.get("/api/weather", async (c) => {
23 try {
24 const latitude = c.req.query("latitude");

internshipApp.tsx3 matches

@brigiallenβ€’Updated 1 week ago
33 }
34
35 // Otherwise fetch from API
36 const response = await fetch("/api/tools");
37 if (!response.ok) {
38 throw new Error("Failed to fetch tools");
63 setLoading(true);
64 try {
65 const response = await fetch("/api/search", {
66 method: "POST",
67 headers: {

internshipapi.ts6 matches

@brigiallenβ€’Updated 1 week ago
4import { AITool, SearchRequest, ToolCategory } from "../../shared/types";
5
6const api = new Hono();
7const openai = new OpenAI();
8
9// Get all tools
10api.get("/tools", async (c) => {
11 try {
12 const tools = await getAllTools();
19
20// Get tool by ID
21api.get("/tools/:id", async (c) => {
22 try {
23 const id = parseInt(c.req.param("id"));
36
37// Get tools by category
38api.get("/tools/category/:category", async (c) => {
39 try {
40 const category = c.req.param("category") as ToolCategory;
48
49// Search tools with AI enhancement
50api.post("/search", async (c) => {
51 try {
52 const body = await c.req.json() as SearchRequest;
126});
127
128export default api;

hotelsListREADME.md3 matches

@mattwd7β€’Updated 1 week ago
5## Structure
6
7- `types.ts` - TypeScript interfaces for hotel data and API requests/responses
8
9## Types
10
11- `Hotel` - Represents a hotel with its details
12- `HotelSearchResponse` - API response format for hotel searches
13- `HotelSearchRequest` - API request format for hotel searches

internshipREADME.md2 matches

@brigiallenβ€’Updated 1 week ago
21β”‚ β”‚ └── queries.ts # Database query functions
22β”‚ β”œβ”€β”€ routes/
23β”‚ β”‚ └── api.ts # API routes for search and recommendations
24β”‚ └── index.ts # Main backend entry point
25β”œβ”€β”€ frontend/
45
46- Frontend: React with Tailwind CSS
47- Backend: Hono API framework
48- AI: OpenAI for query understanding and tool recommendations
49- Database: SQLite for tool information storage

hotelsListREADME.md5 matches

@mattwd7β€’Updated 1 week ago
1# Hotel Finder Backend
2
3This directory contains the backend API for the Hotel Finder application.
4
5## Structure
6
7- `index.ts` - Main entry point for the HTTP API
8- `services/hotelService.ts` - Service for fetching hotel data
9
10## API Endpoints
11
12### GET /api/hotels
13
14Fetches hotels by zip code.
42## Notes
43
44- The current implementation uses mock data. In a production environment, this would be replaced with calls to a real hotel API.
45- Hotels are sorted by weekly price (lowest to highest).

HN-fetch-call2 file matches

@ImGqbβ€’Updated 17 hours ago
fetch HackerNews by API

token-server1 file match

@kwhinnery_openaiβ€’Updated 2 days ago
Mint tokens to use with the OpenAI Realtime API for WebRTC
Kapil01
apiv1