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

# Authentication and Conventions

Developer API endpoints are API-key guarded REST mappings over Swig backend
services.

## Base URL

Examples use:

```text theme={null}
https://api.onswig.com
```

Use the environment-specific base URL provided for your project when working
against dev, staging, or private deployments.

## Authentication

Send your API key as a bearer token:

```text theme={null}
Authorization: Bearer sk_your_api_key
```

Runtime API keys are created in the Developer Portal and should stay on your
server. Do not expose an API key in browser or mobile client code.

This section intentionally excludes developer-portal admin endpoints.

## JSON encoding

The REST API uses protobuf JSON mapping.

| Protobuf type              | JSON form                                                                                          |
| :------------------------- | :------------------------------------------------------------------------------------------------- |
| `string`, `bool`, `double` | ordinary JSON string, boolean, or number                                                           |
| `uint64`, `int64`          | string or number depending on field and client encoder; use strings for large values when in doubt |
| `bytes`                    | base64 string                                                                                      |
| enum fields                | enum names such as `NETWORK_DEVNET`, unless a field explicitly documents a legacy string           |
| `google.protobuf.Struct`   | JSON object                                                                                        |

## Request mapping

Fields in the path template go in the URL. Remaining scalar fields on `GET`
requests become query parameters.

```bash theme={null}
curl "https://api.onswig.com/wallet/swig/ExampleConfig/token-transactions?network=NETWORK_DEVNET&limit=25" \
  -H "Authorization: Bearer sk_your_api_key"
```

For `POST`, `PUT`, and `PATCH` endpoints, the request body is the full request
message unless noted otherwise.

```bash theme={null}
curl "https://api.onswig.com/transaction/transfer/sol" \
  -H "Authorization: Bearer sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "network": "NETWORK_DEVNET",
    "feePayer": "FeePayerPublicKey",
    "swigAddress": "SwigConfigAddress",
    "requesterAuthority": {
      "ed25519": { "publicKey": "RequesterPublicKey" }
    },
    "destination": "DestinationPublicKey",
    "lamports": "1000000"
  }'
```

## Field casing

The protobuf field names are snake\_case. JSON transcoding accepts protobuf JSON
names, which are normally camelCase. This docs section uses camelCase in JSON
examples and snake\_case in endpoint tables when referring to the source proto
field.

## Response shape

Successful responses are JSON encodings of the protobuf response message. API
errors are returned by the gateway or service as HTTP errors with a gRPC status
mapping. See [Errors](/developer-api/errors).
