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=472&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 5096 results for "api"(531ms)

runValAPImain.tsx2 matches

@stevekrouse•Updated 1 year ago
1export function runValAPI(name, ...args) {
2 return fetch(`https://api.val.town/v1/run/${name.replace("@", "")}`, {
3 method: "POST",
4 body: JSON.stringify({

runValAPIAuthmain.tsx1 match

@stevekrouse•Updated 1 year ago
7// Make an authenticated request to another user's val
8// Example usage: https://www.val.town/v/stevekrouse.authRequestEx
9export const runValAPIAuth = async ({ val, args, handle, privateKey, keys }: {
10 val: string;
11 args: any;

tursomain.tsx3 matches

@std•Updated 1 year ago
1import { runValAPIAuth } from "https://esm.town/v/stevekrouse/runValAPIAuth";
2
3// grab the types off turso's client without importing it
6
7export function turso(keys, handle?) {
8 let val = "@std.tursoAPI";
9 let f = (method) => (...args) =>
10 runValAPIAuth({
11 val,
12 args: [method, args],

gptExamplemain.tsx1 match

@stevekrouse•Updated 1 year ago
2import { OpenAI } from "npm:openai";
3
4const openai = new OpenAI({ apiKey: process.env.openai });
5let chatCompletion = await openai.chat.completions.create({
6 messages: [{ role: "user", content: "Make a short joke or pun" }],

modelInvokemain.tsx1 match

@stevekrouse•Updated 1 year ago
4const model = new ChatOpenAI({
5 temperature: 0.9,
6 openAIApiKey: process.env.openai,
7});
8

getValREADME.md1 match

@stevekrouse•Updated 1 year ago
2Gets information about a specific val.
3
4To access private vals, pass your API token as a secret to the function. Read more about [authentication](https://docs.val.town/api/authentication) to understand how to generate a token and save it as a secret.
5
6Migrated from folder: Archive/getVal

btoamain.tsx1 match

@stevekrouse•Updated 1 year ago
1// https://developer.mozilla.org/en-US/docs/Web/API/btoa
2import { Buffer } from "node:buffer";
3

spotifyCreatePlaylistmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { spotifyMe } from "https://esm.town/v/stevekrouse/spotifyMe";
2import { spotifyAPI } from "https://esm.town/v/stevekrouse/spotifyAPI";
3
4export let spotifyCreatePlaylist = async ({token, ...params}) => spotifyAPI({
5 token,
6 endpoint: `users/${(await spotifyMe(token)).id}/playlists`,

googleClientmain.tsx1 match

@stevekrouse•Updated 1 year ago
1export const googleClient = async () => {
2 const { google } = await import("npm:googleapis");
3 const key = { client_id: "test", client_secret: "test" };
4 const client = new google.auth.OAuth2(key.client_id, key.client_secret, [

spotifySearchmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { spotifyAPI } from "https://esm.town/v/stevekrouse/spotifyAPI";
2
3export let spotifySearch = ({...params}) => spotifyAPI({
4 endpoint: 'search',
5 ...params

runValAPIEx2 file matches

@charmaine•Updated 19 hours ago

PassphraseAPI2 file matches

@wolf•Updated 3 days ago
artivilla
founder @outapint.io vibe coding on val.town. dm me to build custom vals: https://artivilla.com
fiberplane
Purveyors of Hono tooling, API Playground enthusiasts, and creators of 🪿 HONC 🪿 (https://honc.dev)