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=546&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 25399 results for "api"(6016ms)

med-copilotstyles.css.ts1 match

@legal•Updated 2 months ago
1export const cssContent =
2 `@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Lobster+Two:ital,wght@1,700&display=swap');
3
4:root {

noteindex.ts2 matches

@peterqliu•Updated 2 months ago
78 }
79
80 // Get geolocation data using ip-api.com (free, no API key required)
81 let geoData;
82 try {
83 const geoResponse = await fetch(`http://ip-api.com/json/${clientIP}`);
84 geoData = await geoResponse.json();
85 } catch (error) {

untitled-tg-yvmain.tsx1 match

@anime_enjoyer•Updated 2 months ago
14 }
15
16 const telegramRes = await fetch(`https://api.telegram.org/bot${BOT_TOKEN}/sendMessage`, {
17 method: "POST",
18 headers: { "Content-Type": "application/json" },

med-copilotapp.js.ts4 matches

@legal•Updated 2 months ago
1export const jsContent = `const $ = s => document.querySelector(s);
2const API_URL = '/api';
3const mainContent = $('#main-content');
4const patientBanner = $('#patient-banner');
224 conversationState.history.push({ question: pathway.initialQuestion, options: pathway.options.map(o => o.response) });
225 conversationState.lastResponse = option.response;
226 const res = await fetch(API_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ endpoint: 'follow-up', task: 'DIAG', patientContext: patientContext, conversationState: conversationState }) });
227 const data = await res.json();
228 if (!res.ok) {
250 mainContent.innerHTML = '<div class="loading-indicator">Analyzing & Executing...</div>';
251 try {
252 const res = await fetch(API_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ endpoint: 'full-process', command: commandText, patientContext: patientContext }) });
253 const data = await res.json();
254 if (!res.ok) throw new Error(data.error || 'API request failed.');
255 patientContext = data.patientContext || {};
256 renderPatientBanner();

pipedream-connectREADME.md5 matches

@valdottown•Updated 2 months ago
7### Actions
8- **Send data to external services** from your Val Town code
9- **Secure authentication** handled automatically - no API keys to manage
10- **Copy & paste code snippets** ready for your vals
11- **Thousands of services** supported: Gmail, Slack, Twitter, Notion, Airtable, and more
26## Misc todos
27
28- [ ] Automatically include `"includeSentViaPipedream": false` for Discord and Slack
29- [ ] Replace Discord & Slack apps with our own https://pipedream.com/docs/connect/managed-auth/oauth-clients/#using-a-custom-oauth-client
30 - [ ] I made one for discord, but am struggling to figure out where to supply the `oauthAppId`. I asked Pipedream.
36## Authentication
37
38This app uses Val Town API tokens for authentication. (Eventually, we'll swap
39this for Val Town OAuth.)
40
41To login, create and supply a Val Town API token with the `user:read` scope only. We store it in cookies.
42
43To run actions on connected apps, you'll also need to supply a Val Town API
44token. If you're doing this from within Val Town, you can use
45`process.env.valtown`, which this app's client libraries will use by default.

pipedream-connectHomePage.tsx2 matches

@valdottown•Updated 2 months ago
19 </a>{" "}
20 provides managed authentication for thousands of services. This application gives Val Town users secure
21 access to APIs without managing OAuth flows or API keys yourself.
22 </p>
23 </div>
46 <div className="w-2 h-2 bg-green-500 rounded-full mt-2 flex-shrink-0"></div>
47 <p className="text-sm text-gray-700">
48 <strong>Secure by default:</strong> Authentication is handled automatically - no API keys to manage
49 </p>
50 </div>

med-copilotmain.tsx6 matches

@legal•Updated 2 months ago
1import { handleApiRequest } from "./api.ts";
2import { jsContent } from "./app.js.ts";
3import { htmlContent } from "./index.html.ts";
9 const pathname = url.pathname;
10
11 // Route API requests
12 if (pathname === "/api" && req.method === "POST") {
13 return await handleApiRequest(req);
14 }
15
16 // Route OPTIONS requests for CORS preflight
17 if (pathname === "/api" && req.method === "OPTIONS") {
18 return await handleApiRequest(req);
19 }
20

med-copilotapi.ts2 matches

@legal•Updated 2 months ago
20 return JSON.parse(content);
21 } catch (err) {
22 log("ERROR", "LLM", `OpenAI API call failed for TID ${tid}`, { error: err.message });
23 throw new Error(`AI model error: ${err.message}`);
24 }
70};
71
72export async function handleApiRequest(req: Request): Promise<Response> {
73 const reqId = `req-${Date.now()}`;
74 const logger = new Logger(reqId);

pipedream-connectmain.tsx2 matches

@wolf•Updated 2 months ago
8
9app.route("/auth", auth);
10app.route("/api/pipedream", pipedream);
11
12app.get("/", async (c) => {
13 // Inject initial data
14 // TODO - prevent XSS attack, do more escaping
15 const user = await getCurrentUser(c);
16 const initialData = { user };

medmain.tsx6 matches

@legal•Updated 2 months ago
252const generateHtml = (sourceUrl) => {
253 const styles = `
254 @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Lobster+Two:ital,wght@1,700&display=swap');
255 :root {
256 --bg-color: #111827;
323 <script type="module">
324 const $ = s => document.querySelector(s);
325 const API_URL = '${sourceUrl}';
326 const mainContent = $('#main-content');
327 const patientBanner = $('#patient-banner');
464 conversationState.history.push({ question: pathway.initialQuestion, options: pathway.options.map(o => o.response) });
465 conversationState.lastResponse = option.response;
466 const res = await fetch(API_URL, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ endpoint: 'follow-up', task: 'DIAG', patientContext: patientContext, conversationState: conversationState }) });
467 const data = await res.json();
468 if (!res.ok) { element.innerHTML = \`<div class="error-msg">\${data.error || 'Follow-up failed.'}</div>\`; return; }
484 mainContent.innerHTML = '<div class="loading-indicator">Analyzing & Executing...</div>';
485 try {
486 const res = await fetch(API_URL, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ endpoint: 'full-process', command: commandText, patientContext: patientContext }) });
487 const data = await res.json();
488 if (!res.ok) throw new Error(data.error || 'API request failed.');
489 patientContext = data.patientContext || {};
490 renderPatientBanner();
552 return JSON.parse(content);
553 } catch (err) {
554 log("ERROR", "LLM", `OpenAI API call failed for TID ${tid}`, { error: err.message });
555 throw new Error(`AI model error: ${err.message}`);
556 }

PixelPixelApiMonitor1 file match

@selfire1•Updated 1 hour ago
Regularly polls the API and messages on an error.

weatherApp1 file match

@dcm31•Updated 7 hours ago
A simple weather app with dropdown cities using Open-Meteo API
fapian
<("<) <(")> (>")>
Kapil01