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

# Add an image from a URL

> Fetches an image from a public HTTPS URL and stores it in the image library, exactly as a multipart upload would. The URL must resolve to a public address (private, loopback, link-local and cloud-metadata addresses are refused), use the default HTTPS port, carry no credentials and have a query string of at most 256 characters; up to three redirects are followed, each checked the same way. The response is returned once the bytes are stored. If the account already holds a file with identical bytes under the same name (the sanitised file name is part of the match, so the same image fetched under a new name is stored again), that file is returned with `deduplicated: true` instead of a copy. Limited to 10 fetches a minute and 2 in flight per account.



## OpenAPI

````yaml /openapi.json post /api/file-upload/from-url
openapi: 3.0.0
info:
  description: >-
    Public REST API for Benchmark Email.


    Authenticate every request by including your API key in the `X-API-Key`
    header.

    Each key is issued with one or more scopes that control which endpoints it
    may call.


    Rate limits: 60 requests per minute per account.

    Monthly quota: determined by your subscription plan.


    Contact text field values are HTML-entity encoded. When a contact is
    created, updated or imported, Benchmark stores its text field values
    HTML-entity escaped: `&` `<` `>` `"` `'` `/` `\` and the backtick become
    `&amp;` `&lt;` `&gt;` `&quot;` `&#x27;` `&#x2F;` `&#x5C;` and `&#96;`.
    Responses return that stored form (for example `Maple &amp; Co` for `Maple &
    Co`), so decode values before displaying them. Send plain, unescaped text in
    requests and search filters: Benchmark escapes it before storing or matching
    it. Create and update also remove anything that looks like an HTML tag,
    including the text after a bare `<`.
  title: Benchmark Email API
  version: 1.0.0
servers:
  - description: >-
      Your account's API base URL. Copy the full URL shown on Settings > API
      Keys in your Benchmark Email account and paste it here.
    url: '{apiBaseUrl}'
    variables:
      apiBaseUrl:
        default: ''
        description: >-
          Your account's API base URL. Copy it from Settings > API Keys in your
          Benchmark Email account.
security:
  - apiKeyAuth: []
tags:
  - description: Account related endpoints
    name: account
  - description: File upload (Unlayer custom storage) endpoints
    name: file-upload
  - description: Contact related endpoints
    name: contact
  - description: Contact structure related endpoints
    name: contact-structure
  - description: List related endpoints
    name: lists
  - description: Contact import related endpoints
    name: contact-import
  - description: Email domain related endpoints
    name: email-domain
  - description: Email campaign related endpoints
    name: email-campaign
  - description: Email template related endpoints
    name: email-template
  - description: Report related endpoints
    name: reports
paths:
  /api/file-upload/from-url:
    post:
      tags:
        - file-upload
      summary: Add an image from a URL
      description: >-
        Fetches an image from a public HTTPS URL and stores it in the image
        library, exactly as a multipart upload would. The URL must resolve to a
        public address (private, loopback, link-local and cloud-metadata
        addresses are refused), use the default HTTPS port, carry no credentials
        and have a query string of at most 256 characters; up to three redirects
        are followed, each checked the same way. The response is returned once
        the bytes are stored. If the account already holds a file with identical
        bytes under the same name (the sanitised file name is part of the match,
        so the same image fetched under a new name is stored again), that file
        is returned with `deduplicated: true` instead of a copy. Limited to 10
        fetches a minute and 2 in flight per account.
      operationId: uploadFileFromUrl
      parameters:
        - description: >-
            Source recorded on the stored file. Defaults to `upload`; files
            stored under other sources are excluded from the default listing.
          in: query
          name: source
          required: false
          schema:
            default: upload
            enum:
              - upload
              - brand-kit
            type: string
      requestBody:
        content:
          application/json:
            schema:
              properties:
                fileName:
                  description: >-
                    Name to store the image under, without path separators or
                    control characters; its extension is set to match the image
                    type. Defaults to the last segment of the URL path.
                  example: logo.png
                  maxLength: 200
                  minLength: 1
                  pattern: ^[^\u0000-\u001f\u007f/\\]+$
                  type: string
                url:
                  description: >-
                    Public HTTPS URL of a JPEG, PNG, GIF or WebP image of at
                    most 10 MB. Up to three redirects are followed.
                  example: https://www.example.com/images/logo.png
                  maxLength: 2048
                  minLength: 1
                  type: string
              required:
                - url
              type: object
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                properties:
                  createdAt:
                    format: date-time
                    type: string
                  deduplicated:
                    description: >-
                      True when an identical image already existed in the
                      account and that file was returned instead of a new copy
                    type: boolean
                  fileId:
                    format: uuid
                    type: string
                  fileSize:
                    type: integer
                  height:
                    description: Image height in pixels when known
                    minimum: 1
                    type: integer
                  mimeType:
                    type: string
                  originalName:
                    type: string
                  url:
                    format: uri
                    type: string
                  width:
                    description: Image width in pixels when known
                    minimum: 1
                    type: integer
                type: object
          description: Image stored, or an identical existing image returned
        '400':
          description: >-
            The URL is not a publicly reachable JPEG, PNG, GIF or WebP image
            under 10 MB, the image could not be fetched, or the source is
            unrecognised.
        '403':
          description: API key missing the files:write scope
        '429':
          description: Too many image fetches for this account; retry later
      security:
        - apiKeyAuth: []
components:
  securitySchemes:
    apiKeyAuth:
      description: API key authentication
      in: header
      name: X-API-Key
      type: apiKey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.