# Deposit

## GET /deposit

> Get deposits handler.

```json
{"openapi":"3.0.3","info":{"title":"emily-openapi-spec","version":"0.1.0"},"servers":[{"url":"http://localhost:3031","description":"Local Emily server"},{"url":"https://sbtc-emily.com","description":"Production Emily server"},{"url":"https://temp.sbtc-emily-dev.com","description":"Testnet Emily server"}],"paths":{"/deposit":{"get":{"tags":["deposit"],"summary":"Get deposits handler.","operationId":"getDeposits","parameters":[{"name":"status","in":"query","description":"the status to search by when getting all deposits.","required":true,"schema":{"$ref":"#/components/schemas/DepositStatus"}},{"name":"nextToken","in":"query","description":"the next token value from the previous return of this api call.","required":false,"schema":{"type":"string","nullable":true}},{"name":"pageSize","in":"query","description":"the maximum number of items in the response list.","required":false,"schema":{"type":"integer","format":"int32","nullable":true,"minimum":0}}],"responses":{"200":{"description":"Deposits retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetDepositsResponse"}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Address not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"405":{"description":"Method not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"DepositStatus":{"type":"string","description":"The status of the in-flight sBTC deposit.","enum":["pending","accepted","confirmed","failed","rbf"]},"GetDepositsResponse":{"type":"object","description":"Response to get deposits request.","required":["deposits"],"properties":{"deposits":{"type":"array","items":{"$ref":"#/components/schemas/DepositInfo"},"description":"Deposit infos: deposits with a little less data."},"nextToken":{"type":"string","description":"Next token for the search.","nullable":true}}},"DepositInfo":{"type":"object","description":"Reduced version of the Deposit data.","required":["bitcoinTxid","bitcoinTxOutputIndex","recipient","amount","lastUpdateHeight","lastUpdateBlockHash","status","reclaimScript","depositScript"],"properties":{"amount":{"type":"integer","format":"int64","description":"Amount of BTC being deposited in satoshis.","minimum":0},"bitcoinTxOutputIndex":{"type":"integer","format":"int32","description":"Output index on the bitcoin transaction associated with this specific deposit.","minimum":0},"bitcoinTxid":{"type":"string","description":"Bitcoin transaction id."},"depositScript":{"type":"string","description":"Raw deposit script binary in hex."},"lastUpdateBlockHash":{"type":"string","description":"The most recent Stacks block hash the API was aware of when the deposit was last\nupdated. If the most recent update is tied to an artifact on the Stacks blockchain\nthen this hash is the Stacks block hash that contains that artifact."},"lastUpdateHeight":{"type":"integer","format":"int64","description":"The most recent Stacks block height the API was aware of when the deposit was last\nupdated. If the most recent update is tied to an artifact on the Stacks blockchain\nthen this height is the Stacks block height that contains that artifact.","minimum":0},"recipient":{"type":"string","description":"Stacks address to received the deposited sBTC."},"reclaimScript":{"type":"string","description":"Raw reclaim script binary in hex."},"status":{"$ref":"#/components/schemas/DepositStatus"}}},"ErrorResponse":{"type":"object","description":"Structure representing an error response\nThis is used to serialize error messages in HTTP responses","required":["message"],"properties":{"message":{"type":"string"}}}}}}
```

## POST /deposit

> Create deposit handler.

```json
{"openapi":"3.0.3","info":{"title":"emily-openapi-spec","version":"0.1.0"},"servers":[{"url":"http://localhost:3031","description":"Local Emily server"},{"url":"https://sbtc-emily.com","description":"Production Emily server"},{"url":"https://temp.sbtc-emily-dev.com","description":"Testnet Emily server"}],"paths":{"/deposit":{"post":{"tags":["deposit"],"summary":"Create deposit handler.","operationId":"createDeposit","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDepositRequestBody"}}},"required":true},"responses":{"200":{"description":"Deposit already exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deposit"}}}},"201":{"description":"Deposit created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deposit"}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Address not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"405":{"description":"Method not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"CreateDepositRequestBody":{"type":"object","description":"Request structure for create deposit request.","required":["bitcoinTxid","bitcoinTxOutputIndex","reclaimScript","depositScript","transactionHex"],"properties":{"bitcoinTxOutputIndex":{"type":"integer","format":"int32","description":"Output index on the bitcoin transaction associated with this specific deposit.","minimum":0},"bitcoinTxid":{"type":"string","description":"Bitcoin transaction id."},"depositScript":{"type":"string","description":"Deposit script."},"reclaimScript":{"type":"string","description":"Reclaim script."},"transactionHex":{"type":"string","description":"The raw transaction hex."}}},"Deposit":{"type":"object","description":"Deposit.","required":["bitcoinTxid","bitcoinTxOutputIndex","recipient","amount","lastUpdateHeight","lastUpdateBlockHash","status","statusMessage","parameters","reclaimScript","depositScript"],"properties":{"amount":{"type":"integer","format":"int64","description":"Amount of BTC being deposited in satoshis.","minimum":0},"bitcoinTxOutputIndex":{"type":"integer","format":"int32","description":"Output index on the bitcoin transaction associated with this specific deposit.","minimum":0},"bitcoinTxid":{"type":"string","description":"Bitcoin transaction id."},"depositScript":{"type":"string","description":"Raw deposit script binary in hex."},"fulfillment":{"allOf":[{"$ref":"#/components/schemas/Fulfillment"}],"nullable":true},"lastUpdateBlockHash":{"type":"string","description":"The most recent Stacks block hash the API was aware of when the deposit was last\nupdated. If the most recent update is tied to an artifact on the Stacks blockchain\nthen this hash is the Stacks block hash that contains that artifact."},"lastUpdateHeight":{"type":"integer","format":"int64","description":"The most recent Stacks block height the API was aware of when the deposit was last\nupdated. If the most recent update is tied to an artifact on the Stacks blockchain\nthen this height is the Stacks block height that contains that artifact.","minimum":0},"parameters":{"$ref":"#/components/schemas/DepositParameters"},"recipient":{"type":"string","description":"Stacks address to received the deposited sBTC."},"reclaimScript":{"type":"string","description":"Raw reclaim script binary in hex."},"replacedByTx":{"type":"string","description":"Transaction ID of the transaction that replaced this one via RBF.","nullable":true},"status":{"$ref":"#/components/schemas/DepositStatus"},"statusMessage":{"type":"string","description":"The status message of the deposit."}}},"Fulfillment":{"type":"object","description":"Data about the fulfillment of an sBTC Operation.","required":["BitcoinTxid","BitcoinTxIndex","StacksTxid","BitcoinBlockHash","BitcoinBlockHeight","BtcFee"],"properties":{"BitcoinBlockHash":{"type":"string","description":"Bitcoin block hash of the block that contains the bitcoin transaction that fulfilled\nthis transaction."},"BitcoinBlockHeight":{"type":"integer","format":"int64","description":"Bitcoin block height of the block that contains the bitcoin transaction that fulfilled\nthis transaction.","minimum":0},"BitcoinTxIndex":{"type":"integer","format":"int32","description":"Bitcoin transaction output index of the Bitcoin transaction that fulfilled the\noperation that corresponds to the fulfillment of this specific operation.","minimum":0},"BitcoinTxid":{"type":"string","description":"Bitcoin transaction id of the Bitcoin transaction that fulfilled the operation."},"BtcFee":{"type":"integer","format":"int64","description":"Satoshis consumed to fulfill the sBTC operation.","minimum":0},"StacksTxid":{"type":"string","description":"Stacks transaction Id that fulfilled this operation."}}},"DepositParameters":{"type":"object","description":"Deposit parameters.","required":["maxFee","lockTime"],"properties":{"lockTime":{"type":"integer","format":"int32","description":"Bitcoin block height at which the reclaim script becomes executable.","minimum":0},"maxFee":{"type":"integer","format":"int64","description":"Maximum fee the signers are allowed to take from the deposit to facilitate\nthe transaction.","minimum":0}}},"DepositStatus":{"type":"string","description":"The status of the in-flight sBTC deposit.","enum":["pending","accepted","confirmed","failed","rbf"]},"ErrorResponse":{"type":"object","description":"Structure representing an error response\nThis is used to serialize error messages in HTTP responses","required":["message"],"properties":{"message":{"type":"string"}}}}}}
```

## PUT /deposit

> Update deposits handler.

```json
{"openapi":"3.0.3","info":{"title":"emily-openapi-spec","version":"0.1.0"},"servers":[{"url":"http://localhost:3031","description":"Local Emily server"},{"url":"https://sbtc-emily.com","description":"Production Emily server"},{"url":"https://temp.sbtc-emily-dev.com","description":"Testnet Emily server"}],"security":[{"ApiGatewayKey":[]}],"components":{"securitySchemes":{"ApiGatewayKey":{"type":"apiKey","in":"header","name":"x-api-key","description":"AWS Apigateway key"}},"schemas":{"UpdateDepositsRequestBody":{"type":"object","description":"Request structure for update deposit request.","required":["deposits"],"properties":{"deposits":{"type":"array","items":{"$ref":"#/components/schemas/DepositUpdate"},"description":"Bitcoin transaction id."}}},"DepositUpdate":{"type":"object","description":"A singular Deposit update that contains only the fields pertinent\nto updating the status of a deposit. This includes the key related\ndata in addition to status history related data.","required":["bitcoinTxid","bitcoinTxOutputIndex","status","statusMessage"],"properties":{"bitcoinTxOutputIndex":{"type":"integer","format":"int32","description":"Output index on the bitcoin transaction associated with this specific deposit.","minimum":0},"bitcoinTxid":{"type":"string","description":"Bitcoin transaction id."},"fulfillment":{"allOf":[{"$ref":"#/components/schemas/Fulfillment"}],"nullable":true},"replacedByTx":{"type":"string","description":"Transaction ID of the transaction that replaced this one via RBF.","nullable":true},"status":{"$ref":"#/components/schemas/DepositStatus"},"statusMessage":{"type":"string","description":"The status message of the deposit."}}},"Fulfillment":{"type":"object","description":"Data about the fulfillment of an sBTC Operation.","required":["BitcoinTxid","BitcoinTxIndex","StacksTxid","BitcoinBlockHash","BitcoinBlockHeight","BtcFee"],"properties":{"BitcoinBlockHash":{"type":"string","description":"Bitcoin block hash of the block that contains the bitcoin transaction that fulfilled\nthis transaction."},"BitcoinBlockHeight":{"type":"integer","format":"int64","description":"Bitcoin block height of the block that contains the bitcoin transaction that fulfilled\nthis transaction.","minimum":0},"BitcoinTxIndex":{"type":"integer","format":"int32","description":"Bitcoin transaction output index of the Bitcoin transaction that fulfilled the\noperation that corresponds to the fulfillment of this specific operation.","minimum":0},"BitcoinTxid":{"type":"string","description":"Bitcoin transaction id of the Bitcoin transaction that fulfilled the operation."},"BtcFee":{"type":"integer","format":"int64","description":"Satoshis consumed to fulfill the sBTC operation.","minimum":0},"StacksTxid":{"type":"string","description":"Stacks transaction Id that fulfilled this operation."}}},"DepositStatus":{"type":"string","description":"The status of the in-flight sBTC deposit.","enum":["pending","accepted","confirmed","failed","rbf"]},"UpdateDepositsResponse":{"type":"object","description":"Response to update deposits request.","required":["deposits"],"properties":{"deposits":{"type":"array","items":{"$ref":"#/components/schemas/DepositWithStatus"},"description":"Deposit infos: deposits with a little less data."}}},"DepositWithStatus":{"type":"object","description":"Wrapper for deposit with status code. Used for multi-status responses.\nNote: logically, exactly one field among `error` and `deposit` should be `None`,\nand exactly one should be `Some`, so, storing them as `Result` would be more correct.\nHowever, utopia, which we use for openAPI schema generation, does not allow `Result`\nusage in its structs, and we have to use two `Option`s","required":["status"],"properties":{"deposit":{"allOf":[{"$ref":"#/components/schemas/Deposit"}],"nullable":true},"error":{"type":"string","description":"A string explaining the error that occurred during the deposit update.","nullable":true},"status":{"type":"integer","format":"int32","description":"HTTP status code for the deposit processing result.","minimum":0}}},"Deposit":{"type":"object","description":"Deposit.","required":["bitcoinTxid","bitcoinTxOutputIndex","recipient","amount","lastUpdateHeight","lastUpdateBlockHash","status","statusMessage","parameters","reclaimScript","depositScript"],"properties":{"amount":{"type":"integer","format":"int64","description":"Amount of BTC being deposited in satoshis.","minimum":0},"bitcoinTxOutputIndex":{"type":"integer","format":"int32","description":"Output index on the bitcoin transaction associated with this specific deposit.","minimum":0},"bitcoinTxid":{"type":"string","description":"Bitcoin transaction id."},"depositScript":{"type":"string","description":"Raw deposit script binary in hex."},"fulfillment":{"allOf":[{"$ref":"#/components/schemas/Fulfillment"}],"nullable":true},"lastUpdateBlockHash":{"type":"string","description":"The most recent Stacks block hash the API was aware of when the deposit was last\nupdated. If the most recent update is tied to an artifact on the Stacks blockchain\nthen this hash is the Stacks block hash that contains that artifact."},"lastUpdateHeight":{"type":"integer","format":"int64","description":"The most recent Stacks block height the API was aware of when the deposit was last\nupdated. If the most recent update is tied to an artifact on the Stacks blockchain\nthen this height is the Stacks block height that contains that artifact.","minimum":0},"parameters":{"$ref":"#/components/schemas/DepositParameters"},"recipient":{"type":"string","description":"Stacks address to received the deposited sBTC."},"reclaimScript":{"type":"string","description":"Raw reclaim script binary in hex."},"replacedByTx":{"type":"string","description":"Transaction ID of the transaction that replaced this one via RBF.","nullable":true},"status":{"$ref":"#/components/schemas/DepositStatus"},"statusMessage":{"type":"string","description":"The status message of the deposit."}}},"DepositParameters":{"type":"object","description":"Deposit parameters.","required":["maxFee","lockTime"],"properties":{"lockTime":{"type":"integer","format":"int32","description":"Bitcoin block height at which the reclaim script becomes executable.","minimum":0},"maxFee":{"type":"integer","format":"int64","description":"Maximum fee the signers are allowed to take from the deposit to facilitate\nthe transaction.","minimum":0}}},"ErrorResponse":{"type":"object","description":"Structure representing an error response\nThis is used to serialize error messages in HTTP responses","required":["message"],"properties":{"message":{"type":"string"}}}}},"paths":{"/deposit":{"put":{"tags":["deposit"],"summary":"Update deposits handler.","operationId":"updateDepositsSigner","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDepositsRequestBody"}}},"required":true},"responses":{"200":{"description":"Deposits updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDepositsResponse"}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Address not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"405":{"description":"Method not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## GET /deposit/recipient/{recipient}

> Get deposits by recipient handler.

```json
{"openapi":"3.0.3","info":{"title":"emily-openapi-spec","version":"0.1.0"},"servers":[{"url":"http://localhost:3031","description":"Local Emily server"},{"url":"https://sbtc-emily.com","description":"Production Emily server"},{"url":"https://temp.sbtc-emily-dev.com","description":"Testnet Emily server"}],"paths":{"/deposit/recipient/{recipient}":{"get":{"tags":["deposit"],"summary":"Get deposits by recipient handler.","operationId":"getDepositsForRecipient","parameters":[{"name":"recipient","in":"path","description":"the recipient to search by when getting all deposits.","required":true,"schema":{"type":"string"}},{"name":"nextToken","in":"query","description":"the next token value from the previous return of this api call.","required":false,"schema":{"type":"string","nullable":true}},{"name":"pageSize","in":"query","description":"the maximum number of items in the response list.","required":false,"schema":{"type":"integer","format":"int32","nullable":true,"minimum":0}}],"responses":{"200":{"description":"Deposits retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetDepositsResponse"}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Address not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"405":{"description":"Method not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"GetDepositsResponse":{"type":"object","description":"Response to get deposits request.","required":["deposits"],"properties":{"deposits":{"type":"array","items":{"$ref":"#/components/schemas/DepositInfo"},"description":"Deposit infos: deposits with a little less data."},"nextToken":{"type":"string","description":"Next token for the search.","nullable":true}}},"DepositInfo":{"type":"object","description":"Reduced version of the Deposit data.","required":["bitcoinTxid","bitcoinTxOutputIndex","recipient","amount","lastUpdateHeight","lastUpdateBlockHash","status","reclaimScript","depositScript"],"properties":{"amount":{"type":"integer","format":"int64","description":"Amount of BTC being deposited in satoshis.","minimum":0},"bitcoinTxOutputIndex":{"type":"integer","format":"int32","description":"Output index on the bitcoin transaction associated with this specific deposit.","minimum":0},"bitcoinTxid":{"type":"string","description":"Bitcoin transaction id."},"depositScript":{"type":"string","description":"Raw deposit script binary in hex."},"lastUpdateBlockHash":{"type":"string","description":"The most recent Stacks block hash the API was aware of when the deposit was last\nupdated. If the most recent update is tied to an artifact on the Stacks blockchain\nthen this hash is the Stacks block hash that contains that artifact."},"lastUpdateHeight":{"type":"integer","format":"int64","description":"The most recent Stacks block height the API was aware of when the deposit was last\nupdated. If the most recent update is tied to an artifact on the Stacks blockchain\nthen this height is the Stacks block height that contains that artifact.","minimum":0},"recipient":{"type":"string","description":"Stacks address to received the deposited sBTC."},"reclaimScript":{"type":"string","description":"Raw reclaim script binary in hex."},"status":{"$ref":"#/components/schemas/DepositStatus"}}},"DepositStatus":{"type":"string","description":"The status of the in-flight sBTC deposit.","enum":["pending","accepted","confirmed","failed","rbf"]},"ErrorResponse":{"type":"object","description":"Structure representing an error response\nThis is used to serialize error messages in HTTP responses","required":["message"],"properties":{"message":{"type":"string"}}}}}}
```

## GET /deposit/reclaim-pubkeys/{reclaimPubkeys}

> Get deposits by recipient handler.

```json
{"openapi":"3.0.3","info":{"title":"emily-openapi-spec","version":"0.1.0"},"servers":[{"url":"http://localhost:3031","description":"Local Emily server"},{"url":"https://sbtc-emily.com","description":"Production Emily server"},{"url":"https://temp.sbtc-emily-dev.com","description":"Testnet Emily server"}],"paths":{"/deposit/reclaim-pubkeys/{reclaimPubkeys}":{"get":{"tags":["deposit"],"summary":"Get deposits by recipient handler.","operationId":"getDepositsForReclaimPubkeys","parameters":[{"name":"reclaimPubkeys","in":"path","description":"The dash-separated list of hex-encoded x-only pubkeys used to generate the reclaim_script.","required":true,"schema":{"type":"string"}},{"name":"nextToken","in":"query","description":"the next token value from the previous return of this api call.","required":false,"schema":{"type":"string","nullable":true}},{"name":"pageSize","in":"query","description":"the maximum number of items in the response list.","required":false,"schema":{"type":"integer","format":"int32","nullable":true,"minimum":0}}],"responses":{"200":{"description":"Deposits retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetDepositsResponse"}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Address not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"405":{"description":"Method not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"GetDepositsResponse":{"type":"object","description":"Response to get deposits request.","required":["deposits"],"properties":{"deposits":{"type":"array","items":{"$ref":"#/components/schemas/DepositInfo"},"description":"Deposit infos: deposits with a little less data."},"nextToken":{"type":"string","description":"Next token for the search.","nullable":true}}},"DepositInfo":{"type":"object","description":"Reduced version of the Deposit data.","required":["bitcoinTxid","bitcoinTxOutputIndex","recipient","amount","lastUpdateHeight","lastUpdateBlockHash","status","reclaimScript","depositScript"],"properties":{"amount":{"type":"integer","format":"int64","description":"Amount of BTC being deposited in satoshis.","minimum":0},"bitcoinTxOutputIndex":{"type":"integer","format":"int32","description":"Output index on the bitcoin transaction associated with this specific deposit.","minimum":0},"bitcoinTxid":{"type":"string","description":"Bitcoin transaction id."},"depositScript":{"type":"string","description":"Raw deposit script binary in hex."},"lastUpdateBlockHash":{"type":"string","description":"The most recent Stacks block hash the API was aware of when the deposit was last\nupdated. If the most recent update is tied to an artifact on the Stacks blockchain\nthen this hash is the Stacks block hash that contains that artifact."},"lastUpdateHeight":{"type":"integer","format":"int64","description":"The most recent Stacks block height the API was aware of when the deposit was last\nupdated. If the most recent update is tied to an artifact on the Stacks blockchain\nthen this height is the Stacks block height that contains that artifact.","minimum":0},"recipient":{"type":"string","description":"Stacks address to received the deposited sBTC."},"reclaimScript":{"type":"string","description":"Raw reclaim script binary in hex."},"status":{"$ref":"#/components/schemas/DepositStatus"}}},"DepositStatus":{"type":"string","description":"The status of the in-flight sBTC deposit.","enum":["pending","accepted","confirmed","failed","rbf"]},"ErrorResponse":{"type":"object","description":"Structure representing an error response\nThis is used to serialize error messages in HTTP responses","required":["message"],"properties":{"message":{"type":"string"}}}}}}
```

## GET /deposit/{txid}

> Get deposits for transaction handler.

```json
{"openapi":"3.0.3","info":{"title":"emily-openapi-spec","version":"0.1.0"},"servers":[{"url":"http://localhost:3031","description":"Local Emily server"},{"url":"https://sbtc-emily.com","description":"Production Emily server"},{"url":"https://temp.sbtc-emily-dev.com","description":"Testnet Emily server"}],"paths":{"/deposit/{txid}":{"get":{"tags":["deposit"],"summary":"Get deposits for transaction handler.","operationId":"getDepositsForTransaction","parameters":[{"name":"txid","in":"path","description":"txid associated with the Deposit.","required":true,"schema":{"type":"string"}},{"name":"nextToken","in":"query","description":"the next token value from the previous return of this api call.","required":false,"schema":{"type":"string","nullable":true}},{"name":"pageSize","in":"query","description":"the maximum number of items in the response list.","required":false,"schema":{"type":"integer","format":"int32","nullable":true,"minimum":0}}],"responses":{"200":{"description":"Deposits retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetDepositsForTransactionResponse"}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Address not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"405":{"description":"Method not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"GetDepositsForTransactionResponse":{"type":"object","description":"Response to get deposits for transaction request.","required":["deposits"],"properties":{"deposits":{"type":"array","items":{"$ref":"#/components/schemas/Deposit"},"description":"Deposits."},"nextToken":{"type":"string","description":"Next token for the search.","nullable":true}}},"Deposit":{"type":"object","description":"Deposit.","required":["bitcoinTxid","bitcoinTxOutputIndex","recipient","amount","lastUpdateHeight","lastUpdateBlockHash","status","statusMessage","parameters","reclaimScript","depositScript"],"properties":{"amount":{"type":"integer","format":"int64","description":"Amount of BTC being deposited in satoshis.","minimum":0},"bitcoinTxOutputIndex":{"type":"integer","format":"int32","description":"Output index on the bitcoin transaction associated with this specific deposit.","minimum":0},"bitcoinTxid":{"type":"string","description":"Bitcoin transaction id."},"depositScript":{"type":"string","description":"Raw deposit script binary in hex."},"fulfillment":{"allOf":[{"$ref":"#/components/schemas/Fulfillment"}],"nullable":true},"lastUpdateBlockHash":{"type":"string","description":"The most recent Stacks block hash the API was aware of when the deposit was last\nupdated. If the most recent update is tied to an artifact on the Stacks blockchain\nthen this hash is the Stacks block hash that contains that artifact."},"lastUpdateHeight":{"type":"integer","format":"int64","description":"The most recent Stacks block height the API was aware of when the deposit was last\nupdated. If the most recent update is tied to an artifact on the Stacks blockchain\nthen this height is the Stacks block height that contains that artifact.","minimum":0},"parameters":{"$ref":"#/components/schemas/DepositParameters"},"recipient":{"type":"string","description":"Stacks address to received the deposited sBTC."},"reclaimScript":{"type":"string","description":"Raw reclaim script binary in hex."},"replacedByTx":{"type":"string","description":"Transaction ID of the transaction that replaced this one via RBF.","nullable":true},"status":{"$ref":"#/components/schemas/DepositStatus"},"statusMessage":{"type":"string","description":"The status message of the deposit."}}},"Fulfillment":{"type":"object","description":"Data about the fulfillment of an sBTC Operation.","required":["BitcoinTxid","BitcoinTxIndex","StacksTxid","BitcoinBlockHash","BitcoinBlockHeight","BtcFee"],"properties":{"BitcoinBlockHash":{"type":"string","description":"Bitcoin block hash of the block that contains the bitcoin transaction that fulfilled\nthis transaction."},"BitcoinBlockHeight":{"type":"integer","format":"int64","description":"Bitcoin block height of the block that contains the bitcoin transaction that fulfilled\nthis transaction.","minimum":0},"BitcoinTxIndex":{"type":"integer","format":"int32","description":"Bitcoin transaction output index of the Bitcoin transaction that fulfilled the\noperation that corresponds to the fulfillment of this specific operation.","minimum":0},"BitcoinTxid":{"type":"string","description":"Bitcoin transaction id of the Bitcoin transaction that fulfilled the operation."},"BtcFee":{"type":"integer","format":"int64","description":"Satoshis consumed to fulfill the sBTC operation.","minimum":0},"StacksTxid":{"type":"string","description":"Stacks transaction Id that fulfilled this operation."}}},"DepositParameters":{"type":"object","description":"Deposit parameters.","required":["maxFee","lockTime"],"properties":{"lockTime":{"type":"integer","format":"int32","description":"Bitcoin block height at which the reclaim script becomes executable.","minimum":0},"maxFee":{"type":"integer","format":"int64","description":"Maximum fee the signers are allowed to take from the deposit to facilitate\nthe transaction.","minimum":0}}},"DepositStatus":{"type":"string","description":"The status of the in-flight sBTC deposit.","enum":["pending","accepted","confirmed","failed","rbf"]},"ErrorResponse":{"type":"object","description":"Structure representing an error response\nThis is used to serialize error messages in HTTP responses","required":["message"],"properties":{"message":{"type":"string"}}}}}}
```

## GET /deposit/{txid}/{index}

> Get deposit handler.

```json
{"openapi":"3.0.3","info":{"title":"emily-openapi-spec","version":"0.1.0"},"servers":[{"url":"http://localhost:3031","description":"Local Emily server"},{"url":"https://sbtc-emily.com","description":"Production Emily server"},{"url":"https://temp.sbtc-emily-dev.com","description":"Testnet Emily server"}],"paths":{"/deposit/{txid}/{index}":{"get":{"tags":["deposit"],"summary":"Get deposit handler.","operationId":"getDeposit","parameters":[{"name":"txid","in":"path","description":"txid associated with the Deposit.","required":true,"schema":{"type":"string"}},{"name":"index","in":"path","description":"output index associated with the Deposit.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deposit retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deposit"}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Address not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"405":{"description":"Method not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"Deposit":{"type":"object","description":"Deposit.","required":["bitcoinTxid","bitcoinTxOutputIndex","recipient","amount","lastUpdateHeight","lastUpdateBlockHash","status","statusMessage","parameters","reclaimScript","depositScript"],"properties":{"amount":{"type":"integer","format":"int64","description":"Amount of BTC being deposited in satoshis.","minimum":0},"bitcoinTxOutputIndex":{"type":"integer","format":"int32","description":"Output index on the bitcoin transaction associated with this specific deposit.","minimum":0},"bitcoinTxid":{"type":"string","description":"Bitcoin transaction id."},"depositScript":{"type":"string","description":"Raw deposit script binary in hex."},"fulfillment":{"allOf":[{"$ref":"#/components/schemas/Fulfillment"}],"nullable":true},"lastUpdateBlockHash":{"type":"string","description":"The most recent Stacks block hash the API was aware of when the deposit was last\nupdated. If the most recent update is tied to an artifact on the Stacks blockchain\nthen this hash is the Stacks block hash that contains that artifact."},"lastUpdateHeight":{"type":"integer","format":"int64","description":"The most recent Stacks block height the API was aware of when the deposit was last\nupdated. If the most recent update is tied to an artifact on the Stacks blockchain\nthen this height is the Stacks block height that contains that artifact.","minimum":0},"parameters":{"$ref":"#/components/schemas/DepositParameters"},"recipient":{"type":"string","description":"Stacks address to received the deposited sBTC."},"reclaimScript":{"type":"string","description":"Raw reclaim script binary in hex."},"replacedByTx":{"type":"string","description":"Transaction ID of the transaction that replaced this one via RBF.","nullable":true},"status":{"$ref":"#/components/schemas/DepositStatus"},"statusMessage":{"type":"string","description":"The status message of the deposit."}}},"Fulfillment":{"type":"object","description":"Data about the fulfillment of an sBTC Operation.","required":["BitcoinTxid","BitcoinTxIndex","StacksTxid","BitcoinBlockHash","BitcoinBlockHeight","BtcFee"],"properties":{"BitcoinBlockHash":{"type":"string","description":"Bitcoin block hash of the block that contains the bitcoin transaction that fulfilled\nthis transaction."},"BitcoinBlockHeight":{"type":"integer","format":"int64","description":"Bitcoin block height of the block that contains the bitcoin transaction that fulfilled\nthis transaction.","minimum":0},"BitcoinTxIndex":{"type":"integer","format":"int32","description":"Bitcoin transaction output index of the Bitcoin transaction that fulfilled the\noperation that corresponds to the fulfillment of this specific operation.","minimum":0},"BitcoinTxid":{"type":"string","description":"Bitcoin transaction id of the Bitcoin transaction that fulfilled the operation."},"BtcFee":{"type":"integer","format":"int64","description":"Satoshis consumed to fulfill the sBTC operation.","minimum":0},"StacksTxid":{"type":"string","description":"Stacks transaction Id that fulfilled this operation."}}},"DepositParameters":{"type":"object","description":"Deposit parameters.","required":["maxFee","lockTime"],"properties":{"lockTime":{"type":"integer","format":"int32","description":"Bitcoin block height at which the reclaim script becomes executable.","minimum":0},"maxFee":{"type":"integer","format":"int64","description":"Maximum fee the signers are allowed to take from the deposit to facilitate\nthe transaction.","minimum":0}}},"DepositStatus":{"type":"string","description":"The status of the in-flight sBTC deposit.","enum":["pending","accepted","confirmed","failed","rbf"]},"ErrorResponse":{"type":"object","description":"Structure representing an error response\nThis is used to serialize error messages in HTTP responses","required":["message"],"properties":{"message":{"type":"string"}}}}}}
```
