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/$%7Bart_info.art.src%7D?q=api&page=1466&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 17496 results for "api"(6057ms)

uploadImagemain.tsx1 match

@easrng•Updated 1 year ago
24}
25async function getUploadURL(): Promise<string> {
26 const data = await (await fetch("https://www.val.town/api/trpc/generateImageUploadUrl", {
27 "headers": {
28 "content-type": "application/json",

currencymain.tsx2 matches

@stevekrouse•Updated 1 year ago
6
7export let currency = async (desired, base = "usd", amount = 1) => {
8 let { rates } = await fetchJSON(`https://open.er-api.com/v6/latest/${base}`);
9 if (rates && rates[desired.toUpperCase()]) return amount * (rates[desired.toUpperCase()]);
10 else {
11 let { rates } = await fetchJSON("https://api.coingecko.com/api/v3/exchange_rates");
12 return amount * rates[desired.toLowerCase()]?.value / rates[base.toLowerCase()]?.value;
13 }

blob_adminREADME.md1 match

@samk•Updated 1 year ago
9[![](https://stevekrouse-button.express.val.run/Install)](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
10
11It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
12
13# TODO

lastloginREADME.md1 match

@pomdtr•Updated 1 year ago
75```
76
77See the [URLPattern API](https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API) for reference.
78
79## Logout

spotifyAPImain.tsx2 matches

@HuskyChicken•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export let spotifyAPI = ({token, endpoint, ...params}) => fetchJSON(
4 `https://api.spotify.com/v1/${endpoint}?${new URLSearchParams(params)}`,
5 {
6 headers: { Authorization: `Bearer ${token}` },

rawmain.tsx4 matches

@pomdtr•Updated 1 year ago
4
5async function createScreenshot(code: string) {
6 const apiUrl = "https://sourcecodeshots.com/api/image";
7 const resp = await fetch(apiUrl, {
8 method: "POST",
9 headers: {
39 }
40 }
41 const resp = await fetch(`https://api.val.town/v1/alias/${author}/${name}`, {
42 headers,
43 });
50 const version = url.searchParams.get("v");
51 const resp = await fetch(
52 `https://api.val.town/v1/vals/${val.id}/versions/${version}`,
53 { headers },
54 );

cors_proxyREADME.md1 match

@adrienj•Updated 1 year ago
1```
2curl 'https://taras-free_open_router.web.val.run/api/v1/chat/completions' \
3 -H 'accept: application/json' \
4 -H 'authorization: Bearer THIS_IS_OVERRIDEN_ON_SERVER' \

milligramCssmain.tsx1 match

@xkonti•Updated 1 year ago
9
10export const stylesheets = [
11 "https://fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic",
12 "https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.css",
13 "https://cdnjs.cloudflare.com/ajax/libs/milligram/1.4.1/milligram.css",

memoryApiPolicymain.tsx10 matches

@xkonti•Updated 1 year ago
2import { markdownToHtml } from "https://esm.town/v/xkonti/markdownToHtml";
3
4export const getPolicy = (apiName: string, contactEmail: string, lastUpdated: string) => {
5 if (apiName == null || apiName === "") apiName = "Memory API";
6 if (contactEmail == null || contactEmail === "") throw new Error("Contact email must be specified");
7 if (lastUpdated == null || lastUpdated === "") throw new Error("The last updated date must be specified");
8 const body = markdownToHtml(
9 `# ${apiName} Privacy Policy
10Last Updated: ${lastUpdated}
11
12## 1. Introduction
13Welcome to ${apiName}. This privacy policy outlines our practices regarding the collection, use, and sharing of information through ${apiName}.
14
15## 2. Data Collection and Use
16${apiName} allows users to store, retrieve, list, and delete data. The data stored can be of any type as inputted by the user. We do not restrict or control the content of the data stored. ${apiName} serves as a public database accessible to anyone with an API key.
17
18## 3. User Restrictions
19${apiName} does not impose age or user restrictions. However, users are advised to consider the sensitivity of the information they share.
20
21## 4. Global Use
22Our API is accessible globally. Users from all regions can store and access data on ${apiName}.
23
24## 5. Data Management
25Given the nature of ${apiName}, there are no user accounts or user identification measures. The API operates like a public database where data can be added, viewed, and deleted by any user. Users should be aware that any data they input can be accessed, modified, or deleted by other users.
26
27## 6. Data Security
28${apiName} is protected by an API key; beyond this, there is no specific data security measure in place. Users should not store sensitive, personal, or confidential information using ${apiName}. We assume no responsibility for the security of the data stored.
29
30## 7. Third-Party Involvement
31The API code is run and data is stored by val.town. They act as a third-party service provider for ${apiName}.
32
33## 8. Changes to This Policy

companiesHousePublicDatamain.tsx4 matches

@aeaton•Updated 1 year ago
2 const url = new URL(req.url);
3 const path = url.searchParams.get("path");
4 const apiUrl = new URL(path, "https://api.company-information.service.gov.uk/");
5 const apiKey = Deno.env.get("companiesHouseApiKey");
6 const basicAuth = btoa(apiKey + ":");
7 const response = await fetch(apiUrl, {
8 headers: { Authorization: `Basic ${basicAuth}` },
9 });

RandomQuoteAPI

@Freelzy•Updated 15 hours ago

HAPI7 file matches

@dIgitalfulus•Updated 21 hours ago
Kapil01
apiv1