> ## Documentation Index
> Fetch the complete documentation index at: https://help.teable.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Sign attachment URLs

> Generate signed URLs for attachment files



## OpenAPI

````yaml /swagger.json post /base/{baseId}/sign-attachment-urls
openapi: 3.0.0
info:
  version: 1.0.0
  title: Teable App
  description: Manage Data as easy as drink a cup of tea
  x-logo:
    backgroundColor: '#F0F0F0'
    altText: Teable logo
servers:
  - url: https://app.teable.ai/api
security: []
paths:
  /base/{baseId}/sign-attachment-urls:
    post:
      tags:
        - base
      summary: Sign attachment URLs
      description: Generate signed URLs for attachment files
      parameters:
        - schema:
            type: string
            description: The base ID
          required: true
          description: The base ID
          name: baseId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                attachments:
                  type: array
                  items:
                    type: object
                    properties:
                      path:
                        type: string
                        description: The file path of the attachment
                      token:
                        type: string
                        description: The access token for the attachment
                      mimetype:
                        type: string
                        description: The MIME type of the attachment
                        example: image/png
                    required:
                      - path
                      - token
                  description: List of attachments to sign
              required:
                - attachments
      responses:
        '200':
          description: URLs signed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  attachments:
                    type: array
                    items:
                      type: object
                      properties:
                        token:
                          type: string
                          description: The original attachment token
                        url:
                          type: string
                          description: The signed URL for the attachment
                      required:
                        - token
                        - url
                    description: List of signed attachments with their tokens and URLs
                required:
                  - attachments
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: Shell
          source: |-
            curl --request POST \
              --url https://app.teable.ai/api/base/%7BbaseId%7D/sign-attachment-urls \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"attachments":[{"path":"string","token":"string","mimetype":"image/png"}]}'
        - lang: JavaScript
          source: >-
            const url =
            'https://app.teable.ai/api/base/%7BbaseId%7D/sign-attachment-urls';

            const options = {
              method: 'POST',
              headers: {
                Authorization: 'Bearer REPLACE_BEARER_TOKEN',
                'content-type': 'application/json'
              },
              body: '{"attachments":[{"path":"string","token":"string","mimetype":"image/png"}]}'
            };


            try {
              const response = await fetch(url, options);
              const data = await response.json();
              console.log(data);
            } catch (error) {
              console.error(error);
            }
        - lang: Node.js
          source: >-
            const http = require('https');


            const options = {
              method: 'POST',
              hostname: 'app.teable.ai',
              port: null,
              path: '/api/base/%7BbaseId%7D/sign-attachment-urls',
              headers: {
                Authorization: 'Bearer REPLACE_BEARER_TOKEN',
                'content-type': 'application/json'
              }
            };


            const req = http.request(options, function (res) {
              const chunks = [];

              res.on('data', function (chunk) {
                chunks.push(chunk);
              });

              res.on('end', function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });


            req.write(JSON.stringify({attachments: [{path: 'string', token:
            'string', mimetype: 'image/png'}]}));

            req.end();
        - lang: Python
          source: >-
            import http.client


            conn = http.client.HTTPSConnection("app.teable.ai")


            payload =
            "{\"attachments\":[{\"path\":\"string\",\"token\":\"string\",\"mimetype\":\"image/png\"}]}"


            headers = {
                'Authorization': "Bearer REPLACE_BEARER_TOKEN",
                'content-type': "application/json"
            }


            conn.request("POST", "/api/base/%7BbaseId%7D/sign-attachment-urls",
            payload, headers)


            res = conn.getresponse()

            data = res.read()


            print(data.decode("utf-8"))
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````