# Initialize Token Stream

```typescript
const now = nowInSec();
const streamRate = FungibleTokenAmount.parse("0.0001", 18).toString();
const startTime = (now + 10).toString();
const endTime = (now + 400).toString(); // 5 min
const receiver = "receiverAccountId.testnet";
const canCancel = true;
const canUpdate = true;
const tokenId = "usdc.fakes.testnet";

const streamParams: InitTokenStreamParams = {
   streamRate,
   startTime,
   endTime,
   receiver,
   canCancel,
   canUpdate,
   tokenId,
};

const streamPayload = await client.initTokenStream(streamParams);

const results = await wallet.signAndSendTransactions(streamPayload);

```

For obtaining streamId, you can do in the following way.

```typescript
const receipts = result.receipts_outcome;
if (receipts) {
   const receipt = receipts.find(
   (receipt) => receipt !== undefined && (receipt.outcome as any).executor_id == _contractId,
);
let streamId = "";
if (receipt) {
   const evenLog = receipt.outcome.logs.find((log) => log.includes("Token stream created"));
   if (evenLog) {
	const json = evenLog.substring(11);
	streamId = JSON.parse(json).data.stream_id.toString();
   }
}

```


---

# 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.zebec.io/zebec-near/zebec-near-sdk/normal-stream/initialize-token-stream.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.
