{"swagger":"2.0","info":{"title":"PDF signing API","version":"1.0.0"},"basePath":"/","schemes":["https"],"tags":[{"name":"API","description":"The PDF signing API"},{"name":"Response/callback","description":"Endpoint to receive request status updates. Provided by the API consumer"}],"paths":{"/auth":{"post":{"tags":["API"],"operationId":"/auth/post","produces":["application/json"],"consumes":["application/json"],"parameters":[{"in":"body","name":"body","description":"Signed JWT with client ID","required":true,"schema":{"$ref":"#/definitions/TokenRequest"}}],"description":"Require access token by providing signed JWT with client ID","summary":"Authentication request","responses":{"200":{"description":"Success operation","examples":{"application/json":"{\n  \"access_token\": \"<token>\",\n  \"expires_in\": 3600\n}"},"schema":{"$ref":"#/definitions/TokenResponse"}},"400":{"description":"Invalid indata"}}}},"/request":{"post":{"tags":["API"],"operationId":"/request/post","produces":["application/json"],"consumes":["application/json"],"parameters":[{"name":"Authorization","in":"header","type":"string","required":true},{"in":"body","name":"body","description":"Signature request","required":true,"schema":{"$ref":"#/definitions/CreateRequest"}}],"description":"Create signature request with document(s) and signer(s)","summary":"Create request","responses":{"200":{"description":"Success operation","examples":{"application/json":"{\n  \"id\":\"123\"\n}"},"schema":{"$ref":"#/definitions/CreateResponse"}},"400":{"description":"Invalid indata"},"401":{"description":"Unathorized"}}},"get":{"tags":["API"],"operationId":"/request/get","produces":["application/json"],"parameters":[{"name":"Authorization","in":"header","type":"string","required":true}],"description":"Get all requests created by the current client ID","summary":"Get all requests","responses":{"200":{"description":"Success operation","examples":{"application/json":"[{\n  \"id\": \"123\",\n  \"name\": \"Request 1\",\n  \"description\": \"First request\",\n  \"created\": 1525843503909,\n  \"state\": \"IN_PROGRESS\",\n  \"signatures\": [{\n    \"signer\" : \"signer.second@example.com\",\n    \"signed\": false,\n    \"method\": \"SE_BANKID\"\n  }]\n}, {\n  \"id\": \"124\",\n  \"name\": \"Request 2\",\n  \"description\": \"Second request\",\n  \"created\": 1525843503919,\n  \"state\": \"COMPLETED\",\n  \"signatures\": [{\n    \"signer\" : \"signer.second@example.com\",\n    \"signed\": true,\n    \"signedAt\": 1525843503929,\n    \"method\": \"PM\"\n  }]\n  }\n]"},"schema":{"$ref":"#/definitions/SignatureRequestArray"}},"401":{"description":"Unathorized"}}}},"/request/{id}":{"get":{"tags":["API"],"operationId":"/request/{id}/get","produces":["application/json"],"consumes":[],"parameters":[{"name":"Authorization","in":"header","type":"string","required":true},{"name":"includeDocs","in":"query","type":"boolean","required":false},{"name":"id","in":"path","required":true,"type":"string"}],"description":"Get request info for one specific request","summary":"Get request info","responses":{"200":{"description":"Success operation","examples":{"application/json":"{\n  \"id\": \"123\",\n  \"name\": \"Request 1\",\n  \"description\": \"First request\",\n  \"created\": 1525843503909,\n  \"state\": \"IN_PROGRESS\",\n  \"signatures\": [{\n    \"signer\" : \"signer.second@example.com\",\n    \"signed\": false,\n    \"method\": \"SE_BANKID\",\n    \"comment\": \"A comment\",\n    \"commentAt\": \"1600231846327\"\n  }]\n}"},"schema":{"$ref":"#/definitions/RequestInfo"}},"401":{"description":"Unathorized"},"404":{"description":"Request with provided ID does not exist"}}}},"/sign":{"post":{"tags":["API"],"operationId":"/sign/post","produces":["application/json"],"consumes":["application/json"],"parameters":[{"name":"Authorization","in":"header","type":"string","required":true},{"in":"body","name":"body","description":"Signature request","required":true,"schema":{"$ref":"#/definitions/SignRequest"}}],"description":"Create signature request with document(s) and signer, starts authentication for signer and signs request","summary":"Create and sign request","responses":{"200":{"description":"Success operation","examples":{"application/json":"{\n  \"autostarttoken\":\"9b64ebc6-c468-46fc-ae47-141ef744d72f\",\n  \"requestId\":\"5bcdaef6be49e90001dc641e\"\n}"},"schema":{"$ref":"#/definitions/SignResponse"}},"400":{"description":"Invalid indata"},"401":{"description":"Unathorized"}}}},"/signdoc":{"post":{"tags":["API"],"operationId":"/signdoc/post","produces":["application/json"],"consumes":["application/json"],"parameters":[{"name":"Authorization","in":"header","type":"string","required":true},{"in":"body","name":"body","description":"Signdoc request","required":true,"schema":{"$ref":"#/definitions/SignDocRequest"}}],"description":"Sign document(s)","summary":"Sign documents","responses":{"200":{"description":"Success operation","examples":{"application/json":"{\n  \"name\" : \"My protocol.pdf\",\n  \"document\" : \"<base64 decoded signed document\" \n}"},"schema":{"$ref":"#/definitions/SignResponse"}},"400":{"description":"Invalid indata"},"401":{"description":"Unathorized"}}}},"/response":{"post":{"tags":["Response/callback"],"consumes":["application/json"],"description":"Endpoint to receive response/callbacks","summary":"Response endpoint","responses":{"200":{"description":"Success operation","examples":{"application/json":"{\n  \"id\": \"123\",\n  \"name\": \"Request 1\",\n  \"created\": 1525843503909,\n  \"state\": \"COMPLETED\",\n  \"reason\": \"STATE_CHANGE\" \n}"},"schema":{"$ref":"#/definitions/Callback"}}}}}},"definitions":{"TokenRequest":{"type":"object","properties":{"assertion":{"type":"string"}}},"TokenResponse":{"type":"object","properties":{"access_token":{"type":"string"},"expires_in":{"type":"integer"}}},"CreateRequest":{"type":"object","required":["documents","onBehalfOf","signers","name","signBefore"],"properties":{"documents":{"type":"array","minimum":1,"items":{"$ref":"#/definitions/Document"}},"onBehalfOf":{"default":"swagger","type":"string"},"name":{"type":"string"},"description":{"type":"string"},"responseUrl":{"default":"https://yourdomain.com/signing/response","type":"string"},"viewProtected":{"type":"boolean","default":true},"signBefore":{"type":"integer"},"language":{"type":"string"},"signers":{"type":"array","minimum":1,"items":{"$ref":"#/definitions/Signer"}}}},"Signer":{"type":"object","required":["method","signerEmail"],"properties":{"method":{"type":"string","default":"PM","enum":["PM","SE_BANKID","IDP"]},"signerEmail":{"type":"string","description":"Email to signer"},"userId":{"type":"string","description":"SSN when using SE_BANKID and request is view protected"},"language":{"type":"string"},"accountRef":{"type":"string","description":"Reference to external authentication method. Is required when using IDP as signing method"}}},"RequestSigner":{"type":"object","required":["method","userId"],"properties":{"method":{"type":"string","default":"SE_BANKID","enum":["SE_BANKID"]},"userId":{"type":"string","description":"SSN when using SE_BANKID and request is view protected"}}},"Document":{"type":"object","required":["name","data"],"properties":{"name":{"type":"string"},"data":{"type":"string","description":"Base64 encoded PDF"}}},"CreateResponse":{"type":"object","properties":{"id":{"type":"string"}}},"SignatureRequestArray":{"type":"array","items":{"$ref":"#/definitions/SignatureRequest"}},"SignatureRequest":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"created":{"type":"integer"},"signBefore":{"type":"integer"},"state":{"type":"string"},"signatures":{"type":"array","items":{"$ref":"#/definitions/SignerInfo"}},"viewProtected":{"type":"boolean"}}},"SignerInfo":{"type":"object","properties":{"signer":{"type":"string"},"signed":{"type":"boolean"},"signedAt":{"type":"integer"},"method":{"type":"string"},"comment":{"type":"string"},"commentAt":{"type":"integer"}}},"RequestInfo":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"documents":{"type":"array","items":{"$ref":"#/definitions/Document"}},"created":{"type":"integer"},"signBefore":{"type":"integer"},"state":{"type":"string"},"signatures":{"type":"array","items":{"$ref":"#/definitions/SignerInfo"}},"viewProtected":{"type":"boolean"}}},"SignRequest":{"type":"object","properties":{"documents":{"type":"array","minimum":1,"items":{"$ref":"#/definitions/Document"}},"name":{"type":"string"},"message":{"type":"string"},"responseUrl":{"default":"https://yourdomain.com/signing/response","type":"string"},"signer":{"$ref":"#/definitions/RequestSigner"}}},"SignResponse":{"type":"object","properties":{"autostarttoken":{"type":"string"},"requestId":{"type":"string"}}},"Callback":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"created":{"type":"integer"},"state":{"type":"string","description":"The current state of the request, e.g. IN_PROGRESS"},"reason":{"type":"string","description":"Indicates why there was a callback; state has changed (STATE_CHANGE) or there was a comment (COMMENT)"}}},"SignDocRequest":{"type":"object","properties":{"name":{"type":"string"},"document":{"type":"string"}}},"SignDocResponse":{"type":"object","properties":{"name":{"type":"string"},"document":{"type":"string"}}}}}