# Retrieve attachment GET https://api.payroc.com/v1/attachments/{attachmentId} Use this method to retrieve the details of an attachment. To retrieve the details of an attachment you need its attachmentId. Our gateway returned the attachmentId in the response of the method that you used to upload the attachment. Our gateway returns information about the attachment, including its upload status and the entity that the attachment is linked to. Our gateway doesn't return the file that you uploaded. Reference: https://docs.payroc.com/api/schema/attachments/get-attachment ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Retrieve attachment version: endpoint_attachments.getAttachment paths: /attachments/{attachmentId}: get: operationId: get-attachment summary: Retrieve attachment description: > Use this method to retrieve the details of an attachment. To retrieve the details of an attachment you need its attachmentId. Our gateway returned the attachmentId in the response of the method that you used to upload the attachment. Our gateway returns information about the attachment, including its upload status and the entity that the attachment is linked to. Our gateway doesn't return the file that you uploaded. tags: - - subpackage_attachments parameters: - name: attachmentId in: path description: Unique identifier of the attachment 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 responses: '200': description: Successful request. Returns the attachment. content: application/json: schema: $ref: '#/components/schemas/attachment' '400': description: Invalid request 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: {} '500': description: An error has occured content: {} components: schemas: 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/attachments/12876" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.payroc.com/v1/attachments/12876'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; 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" "net/http" "io" ) func main() { url := "https://api.payroc.com/v1/attachments/12876" req, _ := http.NewRequest("GET", url, nil) 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/attachments/12876") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.get("https://api.payroc.com/v1/attachments/12876") .header("Authorization", "Bearer ") .asString(); ``` ```php request('GET', 'https://api.payroc.com/v1/attachments/12876', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.payroc.com/v1/attachments/12876"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.payroc.com/v1/attachments/12876")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers 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() ```