> ## Documentation Index
> Fetch the complete documentation index at: https://requestscript.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Run your first request script, then save and invoke a contract.

This guide walks you through running a one-off request and then saving a reusable contract. The examples use `curl` and assume a RequestScript server at `http://localhost:3000`. Replace that with your server's address, and add any authentication headers your server requires.

**1. Run a request**

Send a `request` script as the plain-text body of `POST /run`:

```bash theme={null}
curl -X POST http://localhost:3000/run \
  --data-binary @- <<'EOF'
request HelloWorld {
    return "Hello World!"
}
EOF
```

The server runs the script once and returns the value it returned under `returnValue`:

```json theme={null}
{ "returnValue": "Hello World!" }
```

**2. Add some logic**

Scripts can declare variables, compute values and branch:

```kotlin theme={null}
request Discount {
    const price = 80.00
    var total: decimal = price

    if (price > 50) {
        total = price * 0.9
    }

    return { price: price, total: total }
}
```

```json theme={null}
{ "returnValue": { "price": 80, "total": 72 } }
```

**3. Save a contract**

A contract is a named script with parameters that the server stores for later. Save one with `POST /contracts`:

```bash theme={null}
curl -X POST http://localhost:3000/contracts \
  --data-binary @- <<'EOF'
contract greetings.Hello(name: string) {
    return "Hello ${name}!"
}
EOF
```

The server responds with `201 Created` and the contract's details:

```json theme={null}
{
  "path": "greetings",
  "name": "Hello",
  "version": "1",
  "parameters": [{ "name": "name", "type": "string" }]
}
```

**4. Invoke the contract**

Invoke the contract by posting its parameters as JSON to `/run/<path>/<Name>`. The dots in the contract's path become slashes in the URL:

```bash theme={null}
curl -X POST http://localhost:3000/run/greetings/Hello \
  -H "Content-Type: application/json" \
  -d '{ "parameters": { "name": "Ada" } }'
```

```json theme={null}
{ "returnValue": "Hello Ada!" }
```

> [!TIP]
>
> Contracts are immutable. To change one, save it again under a new version, such as `contract greetings.Hello@2(name: string) { ... }`. See [Versioning](/contracts/versioning).

## Next steps

* Learn the language, starting with [Syntax](/language/syntax).
* Call server-provided functions with [resources](/resources/overview).
* See every endpoint in the [HTTP API reference](/reference/http-api).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.