# Sessions

A session is a short-lived client secret for one document and one purpose, so the browser never holds your API key.


## Kinds {#kinds}

| Kind | For | Created for |
| --- | --- | --- |
| `signing` | the signing screen | one signer of an open document |
| `viewing` | a document's status | anyone in your product who may follow it |
| `editing` | preparing and sending a draft | the person sending it |

```bash
curl https://api2.sendforsign.com/v2/sessions \
  -H "Authorization: Bearer $SENDFORSIGN_KEY" -H "Content-Type: application/json" \
  -d '{ "kind": "signing", "document": "doc_…", "party": "pty_…", "expires_in": 3600 }'
```

The answer has `client_secret` (`cs_test_…`). Pass it to a component; it talks to `/v2/client/*` with it and can do only what the session allows.

## Features {#features}

Viewing and editing sessions carry features: what their browser may do.

| Feature | Allows | Default |
| --- | --- | --- |
| `download` | the signed PDF | viewing, editing |
| `remind` | remind waiting signers | viewing, editing |
| `void` | withdraw the document | never by default |
| `parties` | add, change, remove signers | editing |
| `values` | fill the sender's fields, set the message and order | editing |
| `content` | edit the text | editing |
| `send` | send the draft | editing |

A session never gets a feature its creating key lacks: asking for one is refused, and the defaults shrink to what the key may do.

## Security {#security}

- Secrets are derived from the session id with the server key; only a hash is stored.
- A signing session acts for one party only and cannot be created by an agent key.
- Viewing and editing sessions cannot sign.
- Sessions expire (one minute to seven days; one hour by default) and can carry a `return_url`.
