> For the complete documentation index, see [llms.txt](https://docs.shadowcipher.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shadowcipher.in/api-reference/readme.md).

# Overview

Server-to-server API for getting PDFs signed from your own application.

The BSA Signer API lets your server send a PDF (or a template) for signing, send the signer to a secure signing page, and collect the signed PDF afterwards.

## Base URL

```
https://app.shadowcipher.in
```

All endpoints accept and return JSON. Every call except the token request needs a Bearer token.

## How it works

{% stepper %}
{% step %}

### Get an access token

Call [`POST /api/oauth/token`](https://docs.shadowcipher.in/api-reference/endpoints/get-access-token.md) with your client credentials. The token is valid for 30 minutes.
{% endstep %}

{% step %}

### Start a signing transaction

Call [`POST /api/oauth/initiateTxn`](https://docs.shadowcipher.in/api-reference/endpoints/initiate-transaction.md) with the token and the PDF to sign (or a template ID). The response contains a `signing_url`.
{% endstep %}

{% step %}

### Send the signer to the signing page

Redirect the signer's browser to `signing_url`. After signing (or cancelling) they are sent to your `return_url` with `txn_no`, `reference_no` and `status` as query parameters.
{% endstep %}

{% step %}

### Fetch the signed PDF

Call [`POST /api/oauth/fetchDoc`](https://docs.shadowcipher.in/api-reference/endpoints/fetch-document.md) with the `txn_no` to get the signed PDF as base64.
{% endstep %}
{% endstepper %}

## Endpoints

| Method | Endpoint                                                                                                 | What it does                                         |
| ------ | -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| `POST` | [`/api/oauth/token`](https://docs.shadowcipher.in/api-reference/endpoints/get-access-token.md)           | Exchange client credentials for an access token      |
| `POST` | [`/api/oauth/initiateTxn`](https://docs.shadowcipher.in/api-reference/endpoints/initiate-transaction.md) | Start a signing transaction and get the signing link |
| `POST` | [`/api/oauth/fetchDoc`](https://docs.shadowcipher.in/api-reference/endpoints/fetch-document.md)          | Get the transaction's PDF, signed or original        |
| `GET`  | [`/api/oauth/signatureTypes`](https://docs.shadowcipher.in/api-reference/endpoints/signature-types.md)   | List the signature types your client may use         |

## Try it without code

The [simulator](https://app.shadowcipher.in/) runs the full flow in your browser: generate a token, send a PDF, and open a real signing link.

{% hint style="info" %}
The OpenAPI 3.0 specification is available at [`https://app.shadowcipher.in/api-docs/openapi.yaml`](https://app.shadowcipher.in/api-docs/openapi.yaml), and an interactive Swagger view at [`/api-docs`](https://app.shadowcipher.in/api-docs).
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.shadowcipher.in/api-reference/readme.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
