Skip to content
  • Auto
  • Light
  • Dark
Get Started
View as Markdown
Copy Markdown

Open in Claude
Open in ChatGPT

List

client.vals.list(ValListParams { limit, cursor, privacy, user_id } query, RequestOptionsoptions?): Cursor<Val { id, author, createdAt, 5 more } >
get/v2/vals

Lists all vals including all public vals and your unlisted and private vals

ParametersExpand Collapse
query: ValListParams { limit, cursor, privacy, user_id }
limit: number

Maximum items to return in each paginated response

minimum1
maximum100
cursor?: string

Cursor to start the pagination from

formatdate-time
privacy?: "public" | "unlisted" | "private"

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

Accepts one of the following:
"public"
"unlisted"
"private"
user_id?: string

User ID to filter by

formatuuid
ReturnsExpand Collapse
Val { id, author, createdAt, 5 more }

A Val

id: string

The id of the val

formatuuid
author: Author { id, type, username }
id: string
type: "user" | "org"
Accepts one of the following:
"user"
"org"
username: string | null
createdAt: string
description: string | null
imageUrl: string | null

The URL of this val's image

The URL of this resource on Val Town

formaturi

The URL of this resource on this API

formaturi
name: string
privacy: "public" | "unlisted" | "private"

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

Accepts one of the following:
"public"
"unlisted"
"private"
import ValTown from "npm:@valtown/sdk";

const client = new ValTown({
  bearerToken: 'My Bearer Token',
});

// Automatically fetches more pages as needed.
for await (const val of client.vals.list({ limit: 1 })) {
  console.log(val.id);
}
{
  "data": [
    {
      "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "author": {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "type": "user",
        "username": "username"
      },
      "createdAt": "2019-12-27T18:11:19.117Z",
      "description": "description",
      "imageUrl": "imageUrl",
      "links": {
        "html": "https://example.com",
        "self": "https://example.com"
      },
      "name": "name",
      "privacy": "public"
    }
  ],
  "links": {
    "self": "https://example.com",
    "next": "https://example.com",
    "prev": "https://example.com"
  }
}
Returns Examples
{
  "data": [
    {
      "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "author": {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "type": "user",
        "username": "username"
      },
      "createdAt": "2019-12-27T18:11:19.117Z",
      "description": "description",
      "imageUrl": "imageUrl",
      "links": {
        "html": "https://example.com",
        "self": "https://example.com"
      },
      "name": "name",
      "privacy": "public"
    }
  ],
  "links": {
    "self": "https://example.com",
    "next": "https://example.com",
    "prev": "https://example.com"
  }
}