# Quickstart

## Create an Account

1. Create your account on [Inrupt's PodSpaces](https://start.inrupt.com)
2. Save your login credentials securely

## Generate Client Credentials

For simplicity in these first examples, we will interact with the Wallet directly from a backend service via OAuth Client Credentials. User-login via Solid OIDC is covered in [Authentication](/security/authentication.md).

1. Generate client credentials on the [Application Registration](https://login.inrupt.com/registration.html) page
2. Use the client credential to create a session.

```javascript
async function initializeAndLoginSession() {
  const session = new Session();
  await session.login({
    clientId: process.env.CLIENT_ID,
    clientSecret: process.env.CLIENT_SECRET,
    oidcIssuer: "https://login.inrupt.com",
    tokenType: "Bearer",
  });
  
  if (session.info.isLoggedIn && session.info.webId) {
    console.log("Session logged in successfully with WebID");
    return session;
  } else {
    console.error("User is not logged in");
    return null;
  }
}
```

## Add Data to the Wallet

```typescript
async function uploadFile() {
  const session = await initializeAndLoginSession();
  const walletContainer = "https://datawallet.inrupt.com/wallet";
  const path = "path/where/the/file/is/located" + "/text.txt";
  const fileBuffer = await readFile(path);
  const formData = new FormData();
  const file = new File([fileBuffer], path);
  formData.append("file", file);
  formData.append("fileName", fileName);

  const response = await session.fetch(walletContainer, {
    method: "PUT",
    body: formData,
  });

  if (response.status === 200) {
    return "File uploaded successfully";
  } else {
    console.log(response);
  }
}
```

## Get the Wallet Data

```typescript
async function getFile() {
  const session = await initializeAndLoginSession();
  const walletContainer = "https://datawallet.inrupt.com/wallet";
  const file = walletContainer + "/text.txt";
  
  if (!session) {
    throw new Error("Session is undefined");
  }
  
  const response = await session.fetch(file, {
    method: "GET",
  });
  
  if (response.status === 200) {
    const fetchCredential = await response.text();
    return fetchCredential;
  }
}

```

## Delete Data from the Wallet

```typescript
async function deleteFile() {
  const session = await initializeAndLoginSession();
  const walletContainer = "https://datawallet.inrupt.com/wallet";
  const file = walletContainer + "/text.txt";
  
  if (!session) {
    throw new Error("Session is undefined");
  }
  
  const response = await session.fetch(file, {
    method: "DELETE",
  });
  
  if (response.status === 200) {
    return "file deleted successfully";
  }
}
```


---

# 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.inrupt.com/getting-started/readme.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.
