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=211&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 13013 results for "api"(697ms)

HTTP_examplesREADME.md3 matches

@valdottown•Updated 2 weeks ago
1# Val Town Docs - HTTP Examples
2
3HTTP triggers let you expose an API or website from your file.
4
5They are built on the web-standard
6[Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) and
7[Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) objects,
8so are compatible with a number of web frameworks like
9[Hono](https://hono.dev/) and [Peko](https://github.com/sejori/peko).

live-reload2README.md2 matches

@dcm31•Updated 2 weeks ago
29## How It Works
30
311. **Detection**: The system uses the Val Town API to monitor your project for changes
322. **Long Polling**: The client periodically checks if the project has been updated
333. **Smart Polling**: Polling frequency adjusts based on how recently the project was edited:
74- Only works on *.val.run domains (not custom domains)
75- Disabled in iframes (including the Val Town editor preview)
76- Requires the Val Town API to be accessible
77
78## Prior Art

OpenTownie_jacksonLoginRoute.tsx7 matches

@stevekrouse•Updated 2 weeks ago
8 const { isAuthenticated, authenticate, error } = useAuth();
9 const [tokenValue, setTokenValue] = useState("");
10 const [apiKey, setApiKey] = useState("");
11 // const [invalid, setInvalid] = useState(""); // TODO
12
13 const handleSubmit = (e) => {
14 e.preventDefault();
15 authenticate(tokenValue, apiKey);
16 };
17
36 >
37 <div>
38 <label htmlFor="valtown-token" className="label">Val Town API Token</label>
39 <input
40 type="password"
48 </div>
49 <div>
50 <label htmlFor="anthropic-api-key" className="label">Anthropic API Key</label>
51 <input
52 type="password"
53 id="anthropic-api-key"
54 name="anthropic-key"
55 value={apiKey}
56 onChange={e => {
57 setApiKey(e.target.value);
58 }}
59 />

OpenTownie_jacksonuseThreads.tsx1 match

@stevekrouse•Updated 2 weeks ago
2import { useAuth } from "./useAuth.tsx";
3
4const ENDPOINT = "/api/threads";
5
6export function useThreads() {

OpenTownie_jacksonsend-message.ts10 matches

@stevekrouse•Updated 2 weeks ago
15
16app.post("/", async (c) => {
17 let { messages, project, branchId, anthropicApiKey, selectedFiles, images, threadId } = await c.req.json();
18 console.log("Original messages:", JSON.stringify(messages, null, 2));
19 console.log("Images received:", JSON.stringify(images, null, 2));
23 throw new Error("Thread ID is required");
24 }
25 if (!anthropicApiKey) {
26 return Response.json({
27 error: "Anthropic API key is required. Please log out and add your Anthropic API key to use this app.",
28 }, { status: 400 });
29 }
30 let apiKey;
31 if (!anthropicApiKey) {
32 return Response.json({
33 error: "Anthropic API key is required. Please log out and add your Anthropic API key to use this app.",
34 }, { status: 400 });
35 } else if (anthropicApiKey === Deno.env.get("PASSWORD")) {
36 apiKey = Deno.env.get("PROVIDED_ANTHROPIC_API_KEY");
37 } else {
38 apiKey = anthropicApiKey;
39 }
40
41 const anthropic = createAnthropic({
42 apiKey,
43 });
44

headersExampleREADME.md1 match

@chadparker•Updated 2 weeks ago
1Migrated from folder: Web_API/headersExample
3import { updateThreadName } from "../database/queries.ts";
4
5export async function generateThreadName(apiKey, firstMessage, anthropicApiKey) {
6 const anthropic = createAnthropic({
7 apiKey,
8 });
9

sqliteExplorerAppREADME.md1 match

@skynocover•Updated 2 weeks 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

@skynocover•Updated 2 weeks 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 />

ca_highlightsmain.tsx5 matches

@exgenesis•Updated 2 weeks ago
8// env secrets:
9// NEXT_PUBLIC_SUPABASE_URL, SUPABASE_SERVICE_ROLE
10// X_API_KEY, X_API_SECRET, X_ACCESS_TOKEN, X_ACCESS_TOKEN_SECRET
11// X_USERNAME (optional label)
12// -----------------------------------------------------------------------------
28);
29
30const apiKey = Deno.env.get("X_API_KEY")!;
31const apiSecret = Deno.env.get("X_API_SECRET")!;
32const userToken = Deno.env.get("X_ACCESS_TOKEN")!;
33const userSecret = Deno.env.get("X_ACCESS_TOKEN_SECRET")!;
59// ---------- oauth1 tweet helper ----------
60const oauth = new OAuth({
61 consumer: { key: apiKey, secret: apiSecret },
62 signature_method: "HMAC-SHA1",
63 hash_function(base, key) {
66});
67async function postTweet(text: string): Promise<boolean | "RATE_LIMIT"> {
68 const url = "https://api.twitter.com/2/tweets";
69 const body = JSON.stringify({ text });
70 const authHeader = oauth.toHeader(

vapi-minutes-db1 file match

@henrywilliams•Updated 2 days ago

vapi-minutes-db2 file matches

@henrywilliams•Updated 2 days ago
snartapi
mux
Your friendly, neighborhood video API.