# Tokens (Client upload)

```typescript
import { f0 } from 'file0';

// Generate a file-scoped token
// With this token you can execute any command scoped to the given file.
const token = await f0.createToken('hello.txt', {
  expiresIn: '1h',
  maxUploadSize: '1mb',
});

// Use the token to upload the file
// Providing the file name is not required,
// because the token is already containing the file name.
await f0.useToken(token).set(myFile);

// You can also use the token to anything else,
// like to publish or download the file.
await f0.useToken(token).publish();
const text = await f0.useToken(token).get({ as: 'text'});
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.file0.dev/sdk/tokens-client-upload.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
