Skip to content
  • Auto
  • Light
  • Dark
Get Started

List

List
client.search.vals.list(ValListParamsquery, RequestOptionsoptions?): PageCursorURL<idstringauthorunioncodeunioncreatedAtstringlinksLinksnamestringprivacyunionpublicbooleantypeunionupdatedAtstringurlstringversionnumberValListResponse>
get/v1/search/vals

Search for vals across the platform

Parameters
querylimitnumberoffsetnumberquerystringValListParams
Hide ParametersShow Parameters
limitnumber

Maximum items to return in each paginated response

minimum1
maximum100
offsetnumber

Number of items to skip in order to deliver paginated results

minimum0
querystring

Search query

minLength1
maxLength256
Returns
ValListResponse

A Val

Hide ParametersShow Parameters
idstring

This val's id

formatuuid
authorunion
idstringusernameunionAuthor | null

The user who created this val

Hide ParametersShow Parameters
idstring
formatuuid
usernameunion
string | null
codeunion
string | null

TypeScript code associated with this val

createdAtstring
formatdate-time
namestring

The name of this val

privacyunion
"public" | "unlisted" | "private"

This resource's privacy setting. Unlisted resources do not appear on profile pages or elsewhere, but you can link to them.

Hide ParametersShow Parameters
"public"
"unlisted"
"private"
publicboolean

Whether this val is available publicly on Val Town

typeunion
"interval" | "http" | "express" | 4 more

The type of a val. HTTP can receive web requests, Email can receive emails, Cron runs periodically, and Script can be used for libraries or one-off calculations

Hide ParametersShow Parameters
"interval"
"http"
"express"
"email"
"script"
"rpc"
"httpnext"
updatedAtstring
formatdate-time
urlstring

The URL of this resource on the Val Town website

formaturi
versionnumber

The version of this val, starting at zero

minimum0
import ValTown from '@valtown/sdk';

const client = new ValTown();

// Automatically fetches more pages as needed.
for await (const valListResponse of client.search.vals.list({ limit: 1, offset: 0, query: 'x' })) {
  console.log(valListResponse.id);
}
200 Example
{
  "data": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "author": {
        "id": "00000000-0000-0000-0000-000000000000",
        "username": "tmcw"
      },
      "code": "export const count = 1;",
      "createdAt": "2024-06-11T22:05:12.585Z",
      "links": {
        "module": "https://example.com",
        "self": "https://example.com",
        "versions": "https://example.com",
        "endpoint": "https://example.com"
      },
      "name": "counter",
      "privacy": "public",
      "public": true,
      "type": "script",
      "updatedAt": "2019-12-27T18:11:19.117Z",
      "url": "https://val.town/v/tmcw/counter",
      "version": 0
    }
  ],
  "links": {
    "self": "https://example.com",
    "next": "https://example.com",
    "prev": "https://example.com"
  }
}