openapi: 3.0.1
info:
  title: Sales Layer DAM REST API
  version: 2.0.0
  description: >
    The Sales Layer DAM REST API lets external systems work with image assets
    managed by Sales Layer.

Use this reference when you need to list and filter images, retrieve
    individual image records by reference, or remove assets that are no longer
    required by your catalog workflows.

DAM operations are designed for integrations that keep media libraries,
    product imagery, commerce platforms, supplier portals, and other business
    systems aligned with Sales Layer. For implementation guidance, review the
    authentication, pagination, rate limiting, and error handling guides before
    calling the endpoints below.
servers:
  - url: https://api2.saleslayer.com/dam
    description: Sales Layer DAM API
paths:
  /images:
    get:
      tags:
        - Images
      summary: Filter Images
      description: "Returns a paginated collection of the tenant's images, filtered and sorted using OData query options (`$filter`, `$orderby`, `$top`, `$skip`).\r\n \r\n## Authentication\r\n \r\nRequires a valid API key in the `X-API-KEY` header.\r\n \r\n## Status field values\r\n \r\n- `Vd` - Void (not yet started processing)\r\n- `Up` - Updating (being uploaded/updated)\r\n- `Ok` - Processed correctly (ready to use)\r\n- `Re` - Reprocessing\r\n- `Er` - Error (processing failed)\r\n \r\n## Examples\r\n \r\n```
GET /images?$filter=fileType eq 'jpg'
GET /images?$filter=status eq 'Ok'
GET /images?$filter=fileType eq 'png' and status eq 'Ok'
GET /images?$filter=status in ('Ok', 'Re')
GET /images?$filter=contains(reference, 'product')
GET /images?$orderby=createdOn desc
GET /images?$filter=fileType ne 'gif'&$orderby=numLinks desc&$skip=0&$top=50
```
 \r\n \r\n## Error Responses\r\n \r\n- **400 Bad Request**: Invalid filter syntax, unsupported orderby field, invalid pagination parameters, or invalid API key\r\n- **401 Unauthorized**: Missing API key"
      parameters:
        - name: X-API-KEY
          in: header
          description: Tenant's API key (required)
          schema:
            type: string
        - name: $filter
          in: query
          description: OData $filter expression using supported operators and functions
          schema:
            type: string
        - name: $orderby
          in: query
          description: OData $orderby expression — only specific fields are supported
          schema:
            type: string
        - name: $top
          in: query
          description: 'Maximum number of records to return (default: 100, max: 100)'
          schema:
            type: integer
            format: int64
        - name: $skip
          in: query
          description: 'Number of records to skip for pagination (default: 0)'
          schema:
            type: integer
            format: int64
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FilterImagesResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /images({reference}):
    get:
      tags:
        - Images
      summary: Get Image
      description: "In DAM, images are identified by their filename (`reference`), which is unique per tenant.\r\nUse this endpoint to retrieve a specific image when you already know its filename.\r\n \r\n## Authentication\r\n \r\nRequires a valid API key in the `X-API-KEY` header.\r\n \r\n## Example\r\n \r\n```
GET /images(product-main-front.jpg)
X-API-KEY: your-api-key-here
```
 \r\n \r\n## Response (200 OK)\r\n \r\n```json\r\n{\r\n "id": 42,\r\n "reference": "product-main-front.jpg",\r\n "numLinks": 3,\r\n "status": "Ok",\r\n "modifiedOn": "2024-04-05T08:44:33",\r\n "fileType": "png",\r\n "createdOn": "2024-04-05T08:44:33",\r\n "tags": ["animales", "mascotas"],\r\n "originalUrl": "https://cdn.example.com/product-main-front.jpg",\r\n "thumbnailUrl": "https://cdn.example.com/perrito-simpatico_TH.png",\r\n "thumbnailMediumUrl": "https://cdn.example.com/perrito-simpatico_THM.png",\r\n "thumbnailPreviewUrl": "https://cdn.example.com/perrito-simpatico_THP.png",\r\n "width": 800,\r\n "height": 600,\r\n "sizeInBytes": 102400\r\n}\r\n```\r\n \r\n## Error Responses\r\n \r\n- **400 Bad Request**: Invalid API key\r\n- **401 Unauthorized**: Missing API key\r\n- **404 Not Found**: No image with the given reference exists for this tenant"
      parameters:
        - name: X-API-KEY
          in: header
          description: Tenant's API key (required)
          schema:
            type: string
        - name: reference
          in: path
          description: Image filename, unique per tenant (e.g. `product-main-front.jpg`)
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageDto'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    delete:
      tags:
        - Images
      summary: Delete Image
      description: "Deletes an image by its filename (`reference`), which is unique per tenant.\r\n \r\n## Authentication\r\n \r\nRequires a valid API key in the `X-API-KEY` header.\r\n \r\n## Example\r\n \r\n```
DELETE /images(product-main-front.jpg)
X-API-KEY: your-api-key-here
```
 \r\n \r\n## Error Responses\r\n \r\n- **400 Bad Request**: Invalid API key\r\n- **401 Unauthorized**: Missing API key\r\n- **404 Not Found**: No image with the given reference exists for this tenant\r\n- **409 Conflict**: Image is currently being processed and cannot be deleted"
      parameters:
        - name: X-API-KEY
          in: header
          description: Tenant's API key (required)
          schema:
            type: string
        - name: reference
          in: path
          description: Image filename (reference), unique per tenant
          required: true
          schema:
            type: string
      responses:
        '204':
          description: No Content
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
components:
  schemas:
    ImageDto:
      type: object
      properties:
        id:
          type: integer
          format: int32
        reference:
          type: string
          nullable: true
        numLinks:
          type: integer
          format: int32
        status:
          type: string
          nullable: true
        modifiedOn:
          type: string
          format: date-time
        fileType:
          type: string
          nullable: true
        createdOn:
          type: string
          format: date-time
          nullable: true
        tags:
          type: array
          items:
            type: string
          nullable: true
        originalUrl:
          type: string
          nullable: true
        thumbnailUrl:
          type: string
          nullable: true
        thumbnailMediumUrl:
          type: string
          nullable: true
        thumbnailPreviewUrl:
          type: string
          nullable: true
        width:
          type: integer
          format: int32
        height:
          type: integer
          format: int32
        sizeInBytes:
          type: integer
          format: int64
        additionalProperties: false
    FilterImagesResponse:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/ImageDto'
          nullable: true
        count:
          type: integer
          format: int32
        hasNext:
          type: boolean
        additionalProperties: false
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
        additionalProperties: {}
