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%22Image%20title%22?q=api&page=983&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 13019 results for "api"(1172ms)

aquaAntmain.tsx5 matches

@tempguyUpdated 9 months ago
121 const _0x4d306e = _0x249a7e.substr(0, _0x249a7e.indexOf("&"));
122
123 const api = "https://s3taku.com/encrypt-ajax.php?id="
124 + CryptoJS.AES.encrypt(_0x4d306e, CryptoJS.enc.Utf8.parse(key()), {
125 iv: CryptoJS.enc.Utf8.parse(iv()),
126 }).toString() + _0x249a7e.substr(_0x249a7e.indexOf("&")) + "&alias=" + _0x4d306e;
127
128 const apiResponse = await fetch(api, {
129 headers: {
130 "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0",
141 });
142
143 if (!apiResponse.ok) throw new Error(`Failed to fetch API: ${apiResponse.statusText}`);
144
145 const apiData = await apiResponse.json();
146 const _0x3b405f = JSON.parse(
147 CryptoJS.enc.Utf8.stringify(CryptoJS.AES.decrypt(apiData.data, CryptoJS.enc.Utf8.parse(key2()), {
148 iv: CryptoJS.enc.Utf8.parse(iv()),
149 })),

ReactStream_migratedREADME.md4 matches

@jxnblkUpdated 9 months ago
36
37Custom middleware can be added in an array as the third argument.
38Middleware can add data to the `req.data` object or return a response for things like API endpoints.
39
40```tsx
62```tsx
63// example middleware
64async function api (req: Request, res: Response, next): Promise<Response> {
65 if (req.pathname !== "/api") return next();
66 if (req.method === "POST") {
67 return Repsonse.json({ message: "Hello POST request" });
70}
71
72export default render(App, import.meta.url, [ api ]);
73```
74

getSpotifyTrackUrlREADME.md1 match

@dthyressonUpdated 9 months ago
1# getSpotifyTrackUrl
2
3Get a Spotify Track Url using the Spotify Web API given an artist and a song title.
4
5Track info is cached by the query and also the spotify track id, so your popular queries won't have to fetch from Spotify over and over.

valledrawclientmain.tsx1 match

@janpaul123Updated 9 months ago
28 <title>VALL-E-DRAW</title>
29 <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
30 <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@500;700&display=swap"/>
31 <link rel="stylesheet" href="https://esm.sh/tldraw@2.3.0/tldraw.css"/>
32 <link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet" />

ownOpenAIREADME.md1 match

@koraUpdated 9 months ago
1Use my own OpenAI API key to avoid limit

get_gemini_modelsmain.tsx2 matches

@koraUpdated 9 months ago
9export async function getGeminiModels(): Promise<GeminiModel[]> {
10 try {
11 const API_KEY = process.env.GEMINI_API_KEY;
12
13 const response = await fetch(`https://generativelanguage.googleapis.com/v1beta/models?key=${API_KEY}`);
14
15 const data = await response.json();

redAnglerfishmain.tsx1 match

@koraUpdated 9 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3let result = await fetch("https://api64.ipify.org?format=json");
4let json = await result.json();
5console.log(json.ip);

switchbotREADME.md3 matches

@stevekrouseUpdated 9 months ago
11- [ ] Have any other email login ping me for approval or make a private val with a list of approved emails
12
13## Switchbot API
14
15This val authenticates to the switchbot API with `SWITCHBOT_TOKEN` and `SWITCHBOT_KEY`.
16
17Learn how to get your own Switchbot API keys here: [Switchbot Docs](https://github.com/OpenWonderLabs/SwitchBotAPI).
18
19Migrated from folder: Archive/switchbot

switchbotREADME.md3 matches

@stevekrouseUpdated 9 months ago
11- [ ] Have any other email login ping me for approval or make a private val with a list of approved emails
12
13## Switchbot API
14
15This val authenticates to the switchbot API with `SWITCHBOT_TOKEN` and `SWITCHBOT_KEY`.
16
17Learn how to get your own Switchbot API keys here: [Switchbot Docs](https://github.com/OpenWonderLabs/SwitchBotAPI).
18
19Migrated from folder: Archive/switchbot

valleGetValsContextWindowmain.tsx7 matches

@stevekrouseUpdated 9 months ago
2 const readmeVals: any = await (await fetch("https://janpaul123-readmevals.web.val.run/")).json();
3
4 const API_URL = "https://api.val.town";
5
6 const sections = [
118 {
119 prompt: "Write a val that accesses environment variables",
120 code: `const res = await fetch("${API_URL}/v1/me", {
121 headers: {
122 Authorization: \`Bearer \${Deno.env.get("valtown")}\`,
130 code: `import process from "node:process";
131
132 const res = await fetch("${API_URL}/v1/me", {
133 headers: {
134 Authorization: \`Bearer \${process.env.valtown}\`,
299 You can attach files to your emails by using the \`attachments\` field.
300 Attachments need to be [Base64](https://en.wikipedia.org/wiki/Base64) encoded,
301 which is that the [btoa](https://developer.mozilla.org/en-US/docs/Web/API/btoa)
302 method is doing in this example:
303
401 \`\`\`
402
403 ### Lower-level API
404
405 We do provide access to the lower-level getter and setters, which are useful if you are storing non-JSON or binary data, need to stream in your response or request data, or do anything else lower-level.
406
407 - \`async get(key: string)\`: Retrieves a blob for a given key.
408 - \`async set(key: string, value: string | BodyInit)\`: Sets the blob value for a given key. See [BodyInit](https://deno.land/api@v1.38.1?s=BodyInit).
409
410 ### Limitations
533 role: "assistant",
534 content:
535 "```ts\nexport default async function(req: Request): Promise<Response> {\n const apiKey = Deno.env.get(\"METEO_KEY\");\n const apiUrl = `https://api.open-meteo.com/v1/forecast?latitude=40.6782&longitude=-73.9442&hourly=temperature_2m&current_weather=true&apikey=${apiKey}`;\n\n const response = await fetch(apiUrl);\n const weatherData = await response.json();\n\n return new Response(JSON.stringify(weatherData), { headers: { \"Content-Type\": \"application/json\" } });\n}\n```",
536 },
537 {

vapi-minutes-db1 file match

@henrywilliamsUpdated 2 days ago

vapi-minutes-db2 file matches

@henrywilliamsUpdated 2 days ago
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
artivilla
founder @outapint.io vibe coding on val.town. dm me to build custom vals: https://artivilla.com