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

Open in Claude
Open in ChatGPT

Retrieve

client.files.retrieve(stringfileID, RequestOptionsoptions?): FileRetrieveResponse { id, links, name, 4 more }
get/v2/files/{file_id}

Get file metadata by file ID

ParametersExpand Collapse
fileID: string
ReturnsExpand Collapse
FileRetrieveResponse { id, links, name, 4 more }

A File or Directory's Metadata

id: string

The id of the resource

formatuuid

The URL of this resource on Val Town

formaturi

The URL of this resource's source code as a module

formaturi

The URL of this resource on this API

formaturi

This resource's web endpoint, where it serves a website or API

formaturi
name: string
path: string
type: "directory" | "file" | "interval" | 3 more
Accepts one of the following:
"directory"
"file"
"interval"
"http"
"email"
"script"
updatedAt: string
version: number
import ValTown from "npm:@valtown/sdk";

const client = new ValTown();

const file = await client.files.retrieve('file_id');

console.log(file.id);
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "links": {
    "html": "https://example.com",
    "module": "https://example.com",
    "self": "https://example.com",
    "endpoint": "https://example.com"
  },
  "name": "name",
  "path": "path",
  "type": "directory",
  "updatedAt": "2019-12-27T18:11:19.117Z",
  "version": 0
}
Returns Examples
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "links": {
    "html": "https://example.com",
    "module": "https://example.com",
    "self": "https://example.com",
    "endpoint": "https://example.com"
  },
  "name": "name",
  "path": "path",
  "type": "directory",
  "updatedAt": "2019-12-27T18:11:19.117Z",
  "version": 0
}