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=132&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 13896 results for "api"(1327ms)

untitled-8834index.ts5 matches

@hend_elsaeidy•Updated 5 days ago
7
8export default async function(req: Request): Promise<Response> {
9 // Handle API requests for promo code generation
10 if (req.url.includes('/api/generate-promo')) {
11 return handlePromoGeneration(req);
12 }
21
22/**
23 * Handles the API request to generate a promo code
24 */
25async function handlePromoGeneration(req: Request): Promise<Response> {
214 generateBtn.textContent = 'Generating...';
215
216 // Call the API to generate promo code
217 const response = await fetch('/api/generate-promo', {
218 method: 'POST',
219 headers: {

NPLLMenv.ts1 match

@wolf•Updated 5 days ago
2
3export const env = safeEnv({
4 GOOGLE_GENERATIVE_AI_API_KEY: string(),
5});
6

vapi-minutes-dbupdateMinutes.ts2 matches

@henrywilliams•Updated 5 days ago
3const PH_HOST = Deno.env.get("PH_HOST")!;
4const PH_PROJECT_ID = Deno.env.get("PH_PROJECT_ID")!;
5const PH_KEY = Deno.env.get("PH_PERSONAL_API_KEY")!;
6
7const headers = {
43
44 const res = await fetch(
45 `${PH_HOST}/api/projects/${PH_PROJECT_ID}/query/`, // Queries endpoint
46 { method: "POST", headers, body: JSON.stringify(body) },
47 );
sqwnie

sqwniescratch.tsx2 matches

@maxm•Updated 5 days ago
9import { thinkTool } from "./tools/think.tsx";
10
11const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
12
13const anthropic = createAnthropic({
14 apiKey,
15});
16
requests-in-space

requests-in-spaceend.tsx1 match

@shouser•Updated 5 days ago
17 console.log("Message:", decodeURIComponent(message));
18
19 // Make the OpenAI API call
20 const completion = await openai.chat.completions.create({
21 messages: [

stockAppdeno.json1 match

@prashamtrivedi•Updated 5 days ago
2 "tasks": {
3 "dev": "deno run --allow-net --allow-read --allow-env --allow-write inventoryApp.http.tsx",
4 "serve-api": "deno run --allow-net --allow-read --allow-env --allow-write backend/api.http.ts"
5 },
6 "importMap": "import_map.json",

vectorsserver.tsx2 matches

@jxnblk•Updated 5 days ago
14const app = new Hono();
15
16// api server
17app.get("/api", async (c) => {
18 return c.json({ hello: "hi" });
19});

TownieuseUser.tsx1 match

@mackaber•Updated 5 days ago
1import { useState, useEffect } from "react";
2
3const USER_ENDPOINT = "/api/user";
4
5export function useUser() {

Townieuser-summary.ts1 match

@mackaber•Updated 5 days ago
20 SUM(num_images) as total_images
21 FROM ${USAGE_TABLE}
22 WHERE our_api_token = 1
23 GROUP BY user_id, username
24 ORDER BY total_price DESC

TownieuseProject.tsx2 matches

@mackaber•Updated 5 days ago
1import { useState, useEffect } from "react";
2
3const PROJECT_ENDPOINT = "/api/project";
4const FILES_ENDPOINT = "/api/project-files";
5
6export function useProject(projectId: string, branchId?: string) {

new-val-api-demo

@shouser•Updated 17 hours ago
This is an example of using the API to create a val.

groq-api2 file matches

@cameronpak•Updated 21 hours ago
snartapi
mux
Your friendly, neighborhood video API.