> For the complete documentation index, see [llms.txt](https://docs.file0.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.file0.dev/sdk/tokens-client-upload.md).

# 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'});
```
