# Signrawtransactionwithkey

## signrawtransactionwithkey

> Signs inputs for a raw transaction using explicitly provided private keys, without needing access to a local wallet.\
> Useful for offline signing or stateless transaction construction.<br>

```json
{"openapi":"3.0.0","info":{"title":"BlockBook RES-API","version":"1.0.0"},"servers":[{"url":"https://btc-testnet.nownodes.io"}],"security":[{"api-keyAuth":[]}],"components":{"securitySchemes":{"api-keyAuth":{"type":"apiKey","in":"header","name":"api-key"}},"schemas":{"SignRawTransactionWithKeyRequest":{"type":"object","required":["jsonrpc","id","method","params"],"properties":{"jsonrpc":{"type":"string"},"id":{"type":"string"},"method":{"type":"string","enum":["signrawtransactionwithkey"]},"params":{"type":"array","minItems":2,"maxItems":3,"description":"Parameters:\n1. `hexstring` (string, required): The raw transaction hex string.\n2. `privkeys` (array of strings, required): Array of WIF private keys.\n3. `prevtxs` (array, optional): Array of previous output details for inputs to sign.\n","items":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"array","items":{"type":"object","properties":{"txid":{"type":"string","description":"Transaction ID of the UTXO being spent."},"vout":{"type":"integer","description":"Output index."},"scriptPubKey":{"type":"string","description":"Script of the UTXO."},"redeemScript":{"type":"string","description":"(optional) Redeem script for P2SH inputs."},"witnessScript":{"type":"string","description":"(optional) Witness script for P2WSH inputs."},"amount":{"type":"number","description":"Amount in BTC of the UTXO."}}}}]}}}},"SignRawTransactionWithKeyResponse":{"type":"object","properties":{"result":{"type":"object","properties":{"hex":{"type":"string","description":"Signed raw transaction hex"},"complete":{"type":"boolean","description":"True if all inputs were successfully signed"},"errors":{"type":"array","description":"List of signing errors (if any)","items":{"type":"object","properties":{"txid":{"type":"string","description":"Input transaction ID"},"vout":{"type":"integer","description":"Output index"},"scriptSig":{"type":"string","description":"ScriptSig attempted"},"sequence":{"type":"integer","description":"Sequence number"},"error":{"type":"string","description":"Description of the signing error"}}}}}},"error":{"type":"object","nullable":true},"id":{"type":"string"}}}}},"paths":{"/":{"post":{"tags":["signrawtransactionwithkey"],"summary":"signrawtransactionwithkey","description":"Signs inputs for a raw transaction using explicitly provided private keys, without needing access to a local wallet.\nUseful for offline signing or stateless transaction construction.\n","operationId":"signrawtransactionwithkey","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignRawTransactionWithKeyRequest"}}}},"responses":{"200":{"description":"Transaction signed successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignRawTransactionWithKeyResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"string"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"string"}}}}}}}}}
```
