# 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/retrieve ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Retrieve attachment version: endpoint_attachments.retrieve paths: /attachments/{attachmentId}: get: operationId: retrieve 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 Upload Attachment from payroc import Payroc from payroc.environment import PayrocEnvironment client = Payroc( environment=PayrocEnvironment.PRODUCTION ) client.attachments.get_attachment( attachment_id="12876" ) ``` ```java Upload Attachment package com.example.usage; import com.payroc.api.PayrocApiClient; import com.payroc.api.core.Environment; import com.payroc.api.resources.attachments.requests.GetAttachmentRequest; public class Example { public static void main(String[] args) { PayrocApiClient client = PayrocApiClient .builder() .environment( Environment.PRODUCTION ) .build(); client.attachments().getAttachment( "12876", GetAttachmentRequest .builder() .build() ); } } ``` ```ruby Upload Attachment require "payroc" client = Payroc::Client.new(environment: Payroc::Environment::PRODUCTION); client.attachments.retrieve(attachment_id: '12876'); ``` ```csharp Upload Attachment using Payroc; using System.Threading.Tasks; using Payroc.Attachments; namespace Usage; public class Example { public async Task Do() { var client = new BasePayrocClient( clientOptions: new ClientOptions { Environment = PayrocEnvironment.Production } ); await client.Attachments.RetrieveAsync( new RetrieveAttachmentsRequest { AttachmentId = "12876" } ); } } ``` ```go Upload Attachment 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)) } ``` ```php Upload Attachment request('GET', 'https://api.payroc.com/v1/attachments/12876', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```swift Upload Attachment 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() ```