# Upload attachment to processing account POST https://api.payroc.com/v1/processing-accounts/{processingAccountId}/attachments Content-Type: multipart/form-data > Before you upload an attachment, make sure that you follow local privacy regulations and get the merchant's consent to process their information. **Note:** You need the ID of the processing account before you can upload an attachment. If you don't know the processingAccountId, go to the [Retrieve a Merchant Platform](https://docs.payroc.com/api/schema/boarding/merchant-platforms/retrieve) method. The attachment must be an uncompressed file under 30MB in one of the following formats: - .bmp, csv, .doc, .docx, .gif, .htm, .html, .jpg, .jpeg, .msg, .pdf, .png, .ppt, .pptx, .tif, .tiff, .txt, .xls, .xlsx In the request, include the attachment that you want to upload and the following information about the attachment: - **type** - Type of attachment that you want to upload. - **description** - Short description of the attachment. In the response, our gateway returns information about the attachment including its upload status and an attachmentId that you can use to [Retrieve the details of the Attachment](https://docs.payroc.com/api/schema/attachments/get-attachment). Reference: https://docs.payroc.com/api/schema/boarding/processing-accounts/upload-to-processing-account ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Upload attachment to processing account version: endpoint_attachments.uploadToProcessingAccount paths: /processing-accounts/{processingAccountId}/attachments: post: operationId: upload-to-processing-account summary: Upload attachment to processing account description: > > Before you upload an attachment, make sure that you follow local privacy regulations and get the merchant's consent to process their information. **Note:** You need the ID of the processing account before you can upload an attachment. If you don't know the processingAccountId, go to the [Retrieve a Merchant Platform](https://docs.payroc.com/api/schema/boarding/merchant-platforms/retrieve) method. The attachment must be an uncompressed file under 30MB in one of the following formats: - .bmp, csv, .doc, .docx, .gif, .htm, .html, .jpg, .jpeg, .msg, .pdf, .png, .ppt, .pptx, .tif, .tiff, .txt, .xls, .xlsx In the request, include the attachment that you want to upload and the following information about the attachment: - **type** - Type of attachment that you want to upload. - **description** - Short description of the attachment. In the response, our gateway returns information about the attachment including its upload status and an attachmentId that you can use to [Retrieve the details of the Attachment](https://docs.payroc.com/api/schema/attachments/get-attachment). tags: - - subpackage_attachments parameters: - name: processingAccountId in: path description: Unique identifier that we assigned to the processing account. required: true schema: type: string - name: Authorization in: header description: >- Bearer authentication of the form `Bearer `, where token is your auth token. required: true schema: type: string - name: Idempotency-Key in: header description: >- Unique identifier that you generate for each request. You must use the [UUID v4 format](https://www.rfc-editor.org/rfc/rfc4122) for the identifier. For more information about the idempotency key, go to [Idempotency](https://docs.payroc.com/api/idempotency). required: true schema: type: string format: uuid responses: '201': description: Successful request. We received the attachment. content: application/json: schema: $ref: '#/components/schemas/attachment' '400': description: Validation error content: {} '401': description: Identity could not be verified content: {} '403': description: Do not have permissions to perform this action content: {} '404': description: Resource not found content: {} '406': description: Not acceptable content: {} '409': description: Conflict content: {} '413': description: Payload too large content: {} '415': description: Unsupported media type content: {} '500': description: An error has occured content: {} requestBody: content: multipart/form-data: schema: type: object properties: attachment: $ref: >- #/components/schemas/ProcessingAccountsProcessingAccountIdAttachmentsPostRequestBodyContentMultipartFormDataSchemaAttachment description: Object that contains details about the attachment. file: type: string format: binary description: File that you want to upload. required: - attachment - file components: schemas: ProcessingAccountsProcessingAccountIdAttachmentsPostRequestBodyContentMultipartFormDataSchemaAttachmentType: type: string enum: - value: bankingEvidence - value: questionnairesAndLicenses - value: merchantStatements - value: taxDocuments - value: mpaOrAmendment - value: proofOfBusiness - value: financialStatements - value: personalIdentification - value: other ProcessingAccountsProcessingAccountIdAttachmentsPostRequestBodyContentMultipartFormDataSchemaAttachment: type: object properties: type: $ref: >- #/components/schemas/ProcessingAccountsProcessingAccountIdAttachmentsPostRequestBodyContentMultipartFormDataSchemaAttachmentType description: Type of attachment. description: type: string description: Short description of the attachment. metadata: type: object additionalProperties: type: string description: Object that you can send to include custom metadata in the request. required: - type AttachmentType: type: string enum: - value: bankingEvidence - value: questionnairesAndLicenses - value: merchantStatements - value: taxDocuments - value: mpaOrAmendment - value: proofOfBusiness - value: financialStatements - value: personalIdentification - value: other AttachmentUploadStatus: type: string enum: - value: pending - value: accepted - value: rejected AttachmentEntityType: type: string enum: - value: processingAccount AttachmentEntity: type: object properties: type: $ref: '#/components/schemas/AttachmentEntityType' description: Type of entity that the attachment is linked to. id: type: string description: Unique identifier of the entity that the attachment is linked to. required: - type - id attachment: type: object properties: attachmentId: type: string description: Unique identifier that our gateway assigned to the attachment. type: $ref: '#/components/schemas/AttachmentType' description: Type of attachment. uploadStatus: $ref: '#/components/schemas/AttachmentUploadStatus' description: | Upload status of the attachment. The value is one of the following: - `pending` - We have not yet uploaded the attachment. - `accepted` - We have uploaded the attachment. - `rejected` - We rejected the attachment. fileName: type: string description: Name of the file. contentType: type: string description: Content type of the file. description: type: string description: Short description of the attachment. entity: $ref: '#/components/schemas/AttachmentEntity' description: >- Object that contains information about the entity that the attachment is linked to. createdDate: type: string format: date-time description: >- Date and time that we received your request to upload the attachment. lastModifiedDate: type: string format: date-time description: Date and time the attachment was last modified. metadata: type: object additionalProperties: type: string description: Object that you can send to include custom metadata in the request. required: - attachmentId - type - uploadStatus - fileName - contentType - entity - createdDate - lastModifiedDate ``` ## SDK Code Examples ```python import requests url = "https://api.payroc.com/v1/processing-accounts/38765/attachments" files = { "file": "open('string', 'rb')" } payload = { "attachment": "{ \"type\": \"personalIdentification\" }" } headers = { "Idempotency-Key": "8e03978e-40d5-43e8-bc93-6894a57f9324", "Authorization": "Bearer " } response = requests.post(url, data=payload, files=files, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.payroc.com/v1/processing-accounts/38765/attachments'; const form = new FormData(); form.append('attachment', '{ "type": "personalIdentification" }'); form.append('file', 'string'); const options = { method: 'POST', headers: { 'Idempotency-Key': '8e03978e-40d5-43e8-bc93-6894a57f9324', Authorization: 'Bearer ' } }; options.body = form; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.payroc.com/v1/processing-accounts/38765/attachments" payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment\"\r\n\r\n{\n \"type\": \"personalIdentification\"\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Idempotency-Key", "8e03978e-40d5-43e8-bc93-6894a57f9324") req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.payroc.com/v1/processing-accounts/38765/attachments") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Idempotency-Key"] = '8e03978e-40d5-43e8-bc93-6894a57f9324' request["Authorization"] = 'Bearer ' request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment\"\r\n\r\n{\n \"type\": \"personalIdentification\"\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n" response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.post("https://api.payroc.com/v1/processing-accounts/38765/attachments") .header("Idempotency-Key", "8e03978e-40d5-43e8-bc93-6894a57f9324") .header("Authorization", "Bearer ") .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment\"\r\n\r\n{\n \"type\": \"personalIdentification\"\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n") .asString(); ``` ```php request('POST', 'https://api.payroc.com/v1/processing-accounts/38765/attachments', [ 'multipart' => [ [ 'name' => 'attachment', 'contents' => '{ "type": "personalIdentification" }' ], [ 'name' => 'file', 'filename' => 'string', 'contents' => null ] ] 'headers' => [ 'Authorization' => 'Bearer ', 'Idempotency-Key' => '8e03978e-40d5-43e8-bc93-6894a57f9324', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.payroc.com/v1/processing-accounts/38765/attachments"); var request = new RestRequest(Method.POST); request.AddHeader("Idempotency-Key", "8e03978e-40d5-43e8-bc93-6894a57f9324"); request.AddHeader("Authorization", "Bearer "); request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment\"\r\n\r\n{\n \"type\": \"personalIdentification\"\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Idempotency-Key": "8e03978e-40d5-43e8-bc93-6894a57f9324", "Authorization": "Bearer " ] let parameters = [ [ "name": "attachment", "value": "{ \"type\": \"personalIdentification\" }" ], [ "name": "file", "fileName": "string" ] ] let boundary = "---011000010111000001101001" var body = "" var error: NSError? = nil for param in parameters { let paramName = param["name"]! body += "--\(boundary)\r\n" body += "Content-Disposition:form-data; name=\"\(paramName)\"" if let filename = param["fileName"] { let contentType = param["content-type"]! let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8) if (error != nil) { print(error as Any) } body += "; filename=\"\(filename)\"\r\n" body += "Content-Type: \(contentType)\r\n\r\n" body += fileContent } else if let paramValue = param["value"] { body += "\r\n\r\n\(paramValue)" } } let request = NSMutableURLRequest(url: NSURL(string: "https://api.payroc.com/v1/processing-accounts/38765/attachments")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```