# Licensing

The SPACE GASS API is licensed as an **add-on** to your existing
SPACE GASS license. API access is bundled into **Pro and above**
subscriptions, or available as a **yearly add-on** for perpetual
license holders.

## How License Seats Are Consumed

### API License

When the API service is started, an **API license seat** is consumed
and held for the duration of that service process. The seat is
released when the service is stopped.

### SPACE GASS License

When you open a job through the API, a **standard SPACE GASS license
seat** is consumed — the same as opening a job in the desktop
application. The seat is released when you close the job.

### Module Licenses

While working with an open job, additional module licenses (e.g.
plates, master-slave constraints) are consumed as needed. They are
released when you close the job.

## API Modes: ReadWrite and ReadOnly

The API can run in two modes that control how license seats are consumed:

### ReadWrite (default)

In **readwrite** mode the API holds a full SPACE GASS license seat and
can open jobs, create/modify entities, run analyses, and save files —
every endpoint is available.

### ReadOnly

In **readonly** mode the API releases the SPACE GASS license seat,
freeing it for use by the desktop application or another API instance.
While in readonly mode, only read operations are available — you can
query structure, loads, and results, but you cannot create, modify,
or delete entities, run analyses, or save files.

### Switching Modes

Use the `POST /service/access-mode` endpoint to transition between modes:

<CodeTabs>
```csharp title="C#"
// Switch to readonly — releases the SPACE GASS license seat
await client.Service.AccessMode.PostAsync(new AccessModeUpdate { AccessMode = AccessMode.ReadOnly });

// Switch back to readwrite — re-acquires the license seat
await client.Service.AccessMode.PostAsync(new AccessModeUpdate { AccessMode = AccessMode.ReadWrite });
```

```python title="Python"
# Switch to readonly — releases the SPACE GASS license seat
await client.service.access_mode.post(models.AccessModeUpdate(access_mode=models.AccessMode.ReadOnly))

# Switch back to readwrite — re-acquires the license seat
await client.service.access_mode.post(models.AccessModeUpdate(access_mode=models.AccessMode.ReadWrite))
```

```bash title="curl"
# Switch to readonly
curl -X POST http://localhost:34560/api/v1/service/access-mode \
  -H "Content-Type: application/json" \
  -d '{"accessMode": "ReadOnly"}'

# Switch back to readwrite
curl -X POST http://localhost:34560/api/v1/service/access-mode \
  -H "Content-Type: application/json" \
  -d '{"accessMode": "ReadWrite"}'
```
</CodeTabs>

If a job is open when you switch to readonly, the transition is
**queued** (HTTP 202) and commits when the job closes. Check the
current mode and any pending transition via `GET /service/access-mode`
(the `accessMode` and `pendingAccessMode` fields).

If the license seat cannot be re-acquired when switching back to
readwrite (e.g. all seats are in use), the API returns `409 Conflict`
and stays in readonly.

## More Information

For full details on SPACE GASS licensing and pricing, visit
[spacegass.com](https://www.spacegass.com/).
