{"openapi":"3.0.0","info":{"description":"Pigi API Specification","contact":{"name":"mintBlue Support","url":"http://www.mintBlue.com","email":"support@mintBlue.com"},"title":"Pigi","version":"1.0"},"servers":[{"url":"https://api.mintblue.com/api/v1/pigi"},{"url":"https://test.api.next.kyrt.net/api/v1/pigi"},{"url":"http://localhost:8777/api/v1/pigi"}],"components":{"responses":{"uploadResponse":{"description":"Use response.identifiers.transaction[0] if it is present, otherwise use response.identifiers.file[0]","content":{"application/json":{"schema":{"description":"","type":"object","properties":{"pigi":{"type":"object","required":["version","algorithm","encryptedSize","_algorithmIndex","_idHex"],"properties":{"version":{"type":"number"},"algorithm":{"type":"string"},"encryptedSize":{"type":"number"},"_algorithmIndex":{"type":"number"},"_idHex":{"type":"string","description":"file ID"}}},"bitcoin":{"type":"object","properties":{"fee":{"type":"number"},"size":{"type":"number"},"txid":{"type":"string","description":"Bitcoin transaction ID"},"rawtx":{"type":"string","description":"Bitcoin transaction in raw format"},"explore":{"type":"object","description":"URLs to different blockchain explorers","required":["whatsonchain","blockchair"],"properties":{"whatsonchain":{"type":"string"},"blockchair":{"type":"string"}}}},"required":["fee","size","txid","rawtx","explore"]},"identifiers":{"type":"object","required":["file"],"properties":{"file":{"type":"array","items":{"type":"string"}},"transaction":{"type":"array","items":{"type":"string"}},"raw":{"type":"object","properties":{"fileid":{"type":"string"},"secret":{"type":"string"},"txid":{"type":"string","nullable":true}}}}},"info":{"type":"object","properties":{"file":{"type":"array","items":{"type":"string"}},"transaction":{"type":"array","items":{"type":"string"}}},"required":["file","transaction"]}},"required":["pigi","identifiers"]},"examples":{"example-upload-success-with-transaction-created":{"value":{"pigi":{"version":0,"algorithm":"aes-256-cbc:lzma:cbor","encryptedSize":112,"_algorithmIndex":0,"_idHex":"293ed9bd615ab11de703d27de3843c578c04d74c9f3549a00b924e9128036f1c"},"bitcoin":{"fee":188,"size":376,"txid":"48b587c14b2b82c597ac96a910151a99001c999d1f24625170b19e1d22cfc63b","rawtx":"0100000001d2728b2c4255714f740a21f0f60923789fff83caeaecf21879d399163778f185010000006b483045022100a683fa08130489e10ec8bff67b95cf1e755e6879887d24e9411d046a99b4e7ea02205e1bc1c1cae4fb665a7468840440339e6e3235bb5687ab7359bd5b4f16580fdc41210391cb19127cd26e8b419bc15faae19ed3e95a69f38f67560b933f0bb6f10d25f8ffffffff020000000000000000af006a04746573744ca60000293ed9bd615ab11de703d27de3843c578c04d74c9f3549a00b924e9128036f1c0000007013250da79444e87a82af9b82282dea8ba2716cbdd882f86867e9762784d30a8fda1c75932cd5cf6ca5422ee2b7e2f06749efa8f8564961e7e8e2347aeee8d044ee84257fb9135a505c5f78b708ed92e485f220bcf5c57c4b93888f5bd9d1c6e26a45e58972aec18b550ec385f022d11268978866a71d5b3309d4c3dd1a953bdf3f0f0300000000001976a914ae99d5c0320dcdd9971491c8ff20dc6c65f2f50e88ac00000000","explore":{"whatsonchain":"https://www.whatsonchain.com/tx/48b587c14b2b82c597ac96a910151a99001c999d1f24625170b19e1d22cfc63b","blockchair":"https://blockchair.com/bitcoin-sv/transaction/48b587c14b2b82c597ac96a910151a99001c999d1f24625170b19e1d22cfc63b"}},"identifiers":{"raw":{"fileid":"293ed9bd615ab11de703d27de3843c578c04d74c9f3549a00b924e9128036f1c1","secret":"Q4imbEDsOUF1FqzQVdywOGKkBzdICfysNPhTXzPKyLIE","txid":"48b587c14b2b82c597ac96a910151a99001c999d1f24625170b19e1d22cfc63b"},"file":["https://test.api.next.kyrt.net/api/v1/pigi/f/293ed9bd615ab11de703d27de3843c578c04d74c9f3549a00b924e9128036f1c?s=Q4imbEDsOUF1FqzQVdywOGKkBzdICfysNPhTXzPKyLIE","pigi://pigi.kyrt.net/f/293ed9bd615ab11de703d27de3843c578c04d74c9f3549a00b924e9128036f1c?s=Q4imbEDsOUF1FqzQVdywOGKkBzdICfysNPhTXzPKyLIE","http://localhost:8777/api/v1/pigi/f/293ed9bd615ab11de703d27de3843c578c04d74c9f3549a00b924e9128036f1c?s=Q4imbEDsOUF1FqzQVdywOGKkBzdICfysNPhTXzPKyLIE"],"transaction":["https://test.api.next.kyrt.net/api/v1/pigi/t/48b587c14b2b82c597ac96a910151a99001c999d1f24625170b19e1d22cfc63b?s=Q4imbEDsOUF1FqzQVdywOGKkBzdICfysNPhTXzPKyLIE","pigi://pigi.kyrt.net/t/48b587c14b2b82c597ac96a910151a99001c999d1f24625170b19e1d22cfc63b?s=Q4imbEDsOUF1FqzQVdywOGKkBzdICfysNPhTXzPKyLIE","http://localhost:8777/api/v1/pigi/t/48b587c14b2b82c597ac96a910151a99001c999d1f24625170b19e1d22cfc63b?s=Q4imbEDsOUF1FqzQVdywOGKkBzdICfysNPhTXzPKyLIE"]},"info":{"file":["https://test.api.next.kyrt.net/api/v1/pigi/fi/293ed9bd615ab11de703d27de3843c578c04d74c9f3549a00b924e9128036f1c","pigi://pigi.kyrt.net/fi/293ed9bd615ab11de703d27de3843c578c04d74c9f3549a00b924e9128036f1c","http://localhost:8777/api/v1/pigi/fi/293ed9bd615ab11de703d27de3843c578c04d74c9f3549a00b924e9128036f1c"],"transaction":["https://test.api.next.kyrt.net/api/v1/pigi/ti/48b587c14b2b82c597ac96a910151a99001c999d1f24625170b19e1d22cfc63b","pigi://pigi.kyrt.net/ti/48b587c14b2b82c597ac96a910151a99001c999d1f24625170b19e1d22cfc63b","http://localhost:8777/api/v1/pigi/ti/48b587c14b2b82c597ac96a910151a99001c999d1f24625170b19e1d22cfc63b"]}}},"example-upload-success-with-failed-transaction":{"value":{"pigi":{"version":0,"algorithm":"aes-256-cbc:lzma:cbor","encryptedSize":170640,"_algorithmIndex":0,"_idHex":"157a447504916c76e2726f45197492894acbc929fce7470b28048c7d90cfc6fc"},"identifiers":{"file":["https://test.api.next.kyrt.net/api/v1/pigi/f/157a447504916c76e2726f45197492894acbc929fce7470b28048c7d90cfc6fc?s=zrydAJqVxZPvlr7uAa4BQtWyrScqnB4YS1ZyP4lxhif3","pigi://pigi.kyrt.net/f/157a447504916c76e2726f45197492894acbc929fce7470b28048c7d90cfc6fc?s=zrydAJqVxZPvlr7uAa4BQtWyrScqnB4YS1ZyP4lxhif3","http://localhost:8777/api/v1/pigi/f/157a447504916c76e2726f45197492894acbc929fce7470b28048c7d90cfc6fc?s=zrydAJqVxZPvlr7uAa4BQtWyrScqnB4YS1ZyP4lxhif3"]}}}}}},"headers":{"Pigi-Version":{"schema":{"type":"number"},"description":"Version"},"Pigi-Algorithm":{"schema":{"type":"string"},"description":"Encryption algorithm"},"Pigi-File-Id-Hex":{"schema":{"type":"string"},"description":"SHA256 of the uploaded file encoded in hex"}}},"downloadResponse":{"description":"The response body is the file contents","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}},"headers":{"Content-disposition":{"schema":{"type":"string"},"description":"attachment; filename=[fileName]"},"Content-type":{"schema":{"type":"string"},"description":"mimetype"},"Pigi-Version":{"schema":{"type":"number"},"description":"Version"},"Pigi-Algorithm":{"schema":{"type":"string"},"description":"Encryption algorithm"},"Pigi-File-Id-Hex":{"schema":{"type":"string"},"description":"SHA256 of the uploaded file encoded in hex"}}},"statusResponse":{"description":"A status response will show information about file upload's transaction","content":{"application/json":{"schema":{"description":"","type":"object","x-examples":{"example-1":{"txid":"d339c9073e7a7443c335820e788f993ee06d61f1d13cb1ab44daffe036cda869","rawtx":"0100000001dd9005f978009660ae52822a967497055363408e6474f6093e5c5264a50f25490c0000006a473044022056035b127b8541a7668f199b56d11ee1e7058931d1b57375af0d0cff72c10bda0220471323023bfd778dd338b176916e5aa9c1a07397de4507e715ab8f230ccab2874121030dd0beb0cbda787d4999110f8fcce9d613ff2f18bb30a3af9bd830f3b3c8af10ffffffff020000000000000000fd0301006a086d696e74426c75654cf600004aeeb27208f0113709d5b3809445315f2ba27eb6f9e92a123b8044ee41909f08000000c0987fabed4de5bdf06e515186e200a3c917c2facddb3ef626da140f0ae3eb3d6592b4990a4cf45d99c124c0132d3817ed241a540a82949e95167a3dbc1b01c1234a426fb40c07d171862c9bde67923b168cc23116be4e3208e433d8d81194f84a87858323e5d93440933bd58ebdd660e2b08ada1081b86e96d8f3b2d1879ad93e267a3157c94eafb758b5044825ef516f769ee1cd4f68dfe87195cc63458e6c965b83832cf4110e55c1fe10c05afaacf633659739bc01af8b43b868d6a6018eb86ed709d9edf3fc892f61a8d1ffc73d5ee1260000000000001976a91483cf072cbd4940a137e887a0da22664b19ff6ce088ac00000000","size":461,"fee":47,"status":2,"statusText":"published","block":null,"metadata":{"pigi":{"_idHex":"4aeeb27208f0113709d5b3809445315f2ba27eb6f9e92a123b8044ee41909f08","version":0,"algorithm":"aes-256-cbc:lzma:cbor","encryptedSize":192,"_algorithmIndex":0}},"created_at":"2021-11-02T09:48:39.731Z","published_at":"2021-11-02T09:48:39.731Z","confirmed_at":null}},"properties":{"txid":{"type":"string","minLength":1},"rawtx":{"type":"string","minLength":1},"size":{"type":"number"},"fee":{"type":"number"},"status":{"type":"number"},"statusText":{"type":"string"},"block":{"type":"number"},"metadata":{"type":"object","required":["pigi"],"properties":{"pigi":{"type":"object","required":["_idHex","version","algorithm","encryptedSize","_algorithmIndex"],"properties":{"_idHex":{"type":"string","minLength":1},"version":{"type":"number"},"algorithm":{"type":"string","minLength":1},"encryptedSize":{"type":"number"},"_algorithmIndex":{"type":"number"}}}}},"created_at":{"type":"string","minLength":1},"published_at":{"type":"string","minLength":1},"confirmed_at":{"type":"string"}},"required":["txid","rawtx","size","fee","status","metadata","created_at","published_at"]},"examples":{"example-1":{"txid":"d339c9073e7a7443c335820e788f993ee06d61f1d13cb1ab44daffe036cda869","rawtx":"0100000001dd9005f978009660ae52822a967497055363408e6474f6093e5c5264a50f25490c0000006a473044022056035b127b8541a7668f199b56d11ee1e7058931d1b57375af0d0cff72c10bda0220471323023bfd778dd338b176916e5aa9c1a07397de4507e715ab8f230ccab2874121030dd0beb0cbda787d4999110f8fcce9d613ff2f18bb30a3af9bd830f3b3c8af10ffffffff020000000000000000fd0301006a086d696e74426c75654cf600004aeeb27208f0113709d5b3809445315f2ba27eb6f9e92a123b8044ee41909f08000000c0987fabed4de5bdf06e515186e200a3c917c2facddb3ef626da140f0ae3eb3d6592b4990a4cf45d99c124c0132d3817ed241a540a82949e95167a3dbc1b01c1234a426fb40c07d171862c9bde67923b168cc23116be4e3208e433d8d81194f84a87858323e5d93440933bd58ebdd660e2b08ada1081b86e96d8f3b2d1879ad93e267a3157c94eafb758b5044825ef516f769ee1cd4f68dfe87195cc63458e6c965b83832cf4110e55c1fe10c05afaacf633659739bc01af8b43b868d6a6018eb86ed709d9edf3fc892f61a8d1ffc73d5ee1260000000000001976a91483cf072cbd4940a137e887a0da22664b19ff6ce088ac00000000","size":461,"fee":47,"status":2,"statusText":"published","block":null,"metadata":{"pigi":{"_idHex":"4aeeb27208f0113709d5b3809445315f2ba27eb6f9e92a123b8044ee41909f08","version":0,"algorithm":"aes-256-cbc:lzma:cbor","encryptedSize":192,"_algorithmIndex":0}},"created_at":"2021-11-02T09:48:39.731Z","published_at":"2021-11-02T09:48:39.731Z","confirmed_at":null}}}}}},"schemas":{},"securitySchemes":{"API Access Token":{"name":"Mintblue-Access-Token","type":"apiKey","in":"header"}}},"paths":{"/upload":{"post":{"summary":"Upload a file to Bitcoin","operationId":"post-upload","responses":{"200":{"$ref":"#/components/responses/uploadResponse"}},"description":"Upload file.\n\nIf no pigi-* headers are supplied, no additional verification is done. When they are supplied the server validates whether they match the uploaded file.\n\nUse response.identifiers.transaction[0] if it is present, otherwise use response.identifiers.file[0]","requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}}},"examples":{}}},"description":""},"tags":["Upload"],"parameters":[{"schema":{"type":"string"},"in":"header","name":"pigi-file-id-hex","description":"SHA256 of the uploaded file encoded in hex"},{"schema":{"type":"string"},"in":"header","name":"pigi-file-secret-hex","description":"First 32 bytes of the SHA512 of the uploaded file encoded in hex"}],"security":[{"API Access Token":[]}]}},"/f/{fileId}":{"get":{"summary":"Download file by File ID","tags":["Download"],"responses":{"200":{"$ref":"#/components/responses/downloadResponse"},"404":{"description":"Not Found"}},"operationId":"get-lookup-fileId","parameters":[{"schema":{"type":"string"},"in":"query","name":"s","description":"Secret encoded in base62"}],"description":"The content type header will be set to the mimetype of the file"},"parameters":[{"schema":{"type":"string"},"name":"fileId","in":"path","required":true,"description":"File ID encoded in hex"}]},"/t/{txId}":{"get":{"summary":"Download file by Transaction ID","tags":["Download"],"responses":{"200":{"$ref":"#/components/responses/downloadResponse"},"404":{"description":"Not Found"}},"operationId":"get-lookup-txId","parameters":[{"schema":{"type":"string"},"in":"query","name":"s","description":"Secret encoded in base62"}],"description":"The content type header will be set to the mimetype of the file  "},"parameters":[{"schema":{"type":"string"},"name":"txId","in":"path","required":true,"description":"Transaction ID encoded in hex"}]},"/fi/{fileId}":{"parameters":[{"schema":{"type":"string"},"name":"fileId","in":"path","required":true}],"get":{"summary":"Get transaction status by File ID","tags":["Status"],"responses":{"200":{"$ref":"#/components/responses/statusResponse"},"404":{"description":"Not Found"}},"operationId":"get-transactionstatus-fileid","description":"Transaction status contains information about the transaction"}},"/ti/{txId}":{"parameters":[{"schema":{"type":"string"},"name":"txId","in":"path","required":true}],"get":{"summary":"Get transaction status by Transaction ID","tags":["Status"],"responses":{"200":{"$ref":"#/components/responses/statusResponse"},"404":{"description":"Not Found"}},"operationId":"get-transactionstatus-txid","description":"Transaction status contains information about the transaction"}}},"tags":[{"name":"Upload"},{"name":"Download"},{"name":"Status"}]}