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

# Fetch Resources

> Fetch supporting resources scoped to the authenticated organization. The response shape depends on the `resource` parameter.

Retrieve supporting metadata such as domains, folders, pixels, and organization information. The response shape depends on the `resource` you request.

| `resource` value | Description                                                                                                                                                         | Typical use cases                                                                   |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| `domain`         | Returns every active domain available to the organization, including default ShortPen domains. Each item exposes `id`, `domain`, `url`, `active`, and `is_default`. | Populate dropdowns when generating links or validating domain assignments.          |
| `folder`         | Lists folders for the provided `workspace_id`. Each entry contains `id` and `name`.                                                                                 | Mirror folder structure inside your own UI or automations.                          |
| `tag`            | Lists tags for the provided `workspace_id`. Each entry contains `id`, `name`, and `color`.                                                                          | Resolve the `tag_ids` to send when creating or editing links.                       |
| `pixel`          | Lists tracking pixels scoped to the organization with `id`, `name`, and `unique_id`.                                                                                | Attach conversions to links or refresh external systems (for example Shopify apps). |
| `organization`   | Returns organization metadata (`name`, `logo`, `is_default_logo`, `workspaces`, `updated_at`). Workspaces include `id` and `name`.                                  | Show organization pickers or hydrate onboarding flows.                              |

Each successful response is wrapped in the standard envelope (`success`, `status_code`, `data`, `message`). The `data` property matches the structure described in the table above.


## OpenAPI

````yaml POST /v1/get
openapi: 3.1.0
info:
  title: ShortPen API
  version: 1.0.0
  description: >-
    Create branded links, fetch organization resources, and pull analytics
    programmatically with the ShortPen REST API.
servers:
  - url: https://{environment}.shortpen.com
    description: ShortPen API host
    variables:
      environment:
        default: api
        enum:
          - api
          - staging-api
security: []
tags:
  - name: Core
    description: Utility endpoints for checking service health.
  - name: Authentication
    description: Endpoints that return identity, limits, and feature availability.
  - name: Links
    description: Create, edit, and list links and their auxiliary assets like QR codes.
  - name: Resources
    description: >-
      Lookup supporting entities such as domains, workspaces, folders, and
      pixels.
  - name: Analytics
    description: Retrieve click analytics and raw tracking events.
paths:
  /v1/get:
    post:
      tags:
        - Resources
      summary: Fetch resources
      description: >-
        Fetch supporting resources scoped to the authenticated organization. The
        response shape depends on the `resource` parameter.
      operationId: getResources
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetResourceRequest'
            examples:
              domains:
                summary: List available domains
                value:
                  resource: domain
              folders:
                summary: List folders in a workspace
                value:
                  resource: folder
                  workspace_id: 24
              tags:
                summary: List tags in a workspace
                value:
                  resource: tag
                  workspace_id: 24
              organization:
                summary: Get organization summary
                value:
                  resource: organization
      responses:
        '200':
          description: Resource payload
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceResponse'
        '400':
          description: Unsupported resource or validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    GetResourceRequest:
      type: object
      properties:
        resource:
          type: string
          description: Resource to fetch.
          enum:
            - domain
            - folder
            - tag
            - pixel
            - organization
        workspace_id:
          type: integer
          description: Workspace scope used for folder and tag lookups.
      required:
        - resource
    ResourceResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        status_code:
          type: integer
          example: 200
        message:
          type: string
          example: ''
        data:
          description: Payload returned for the requested resource.
          oneOf:
            - $ref: '#/components/schemas/DomainList'
            - $ref: '#/components/schemas/FolderList'
            - $ref: '#/components/schemas/TagList'
            - $ref: '#/components/schemas/PixelList'
            - $ref: '#/components/schemas/OrganizationResource'
            - $ref: '#/components/schemas/AnalyticsSummaryList'
      required:
        - success
        - status_code
        - data
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        status_code:
          type: integer
          example: 401
        message:
          type: string
          example: There was an error while processing your request.
        data:
          description: Optional payload returned for additional context.
          nullable: true
      required:
        - success
        - status_code
        - message
    DomainList:
      type: array
      items:
        $ref: '#/components/schemas/DomainResource'
    FolderList:
      type: array
      items:
        $ref: '#/components/schemas/FolderResource'
    TagList:
      type: array
      items:
        $ref: '#/components/schemas/TagResource'
    PixelList:
      type: array
      items:
        $ref: '#/components/schemas/PixelResource'
    OrganizationResource:
      type: object
      properties:
        name:
          type: string
          example: Acme Corp
        logo:
          type: string
          format: uri
          nullable: true
        is_default_logo:
          type: boolean
          example: false
        workspaces:
          type: array
          items:
            $ref: '#/components/schemas/WorkspaceSummary'
        updated_at:
          type: string
          format: date-time
      required:
        - name
        - is_default_logo
        - workspaces
        - updated_at
    AnalyticsSummaryList:
      type: array
      items:
        $ref: '#/components/schemas/AnalyticsSummary'
    DomainResource:
      type: object
      properties:
        id:
          type: integer
          example: 3
        domain:
          type: string
          example: go.shortpen.com
        url:
          type: string
          format: uri
          example: https://go.shortpen.com/
        active:
          type: boolean
          example: true
        is_default:
          type: boolean
          example: false
      required:
        - id
        - domain
        - url
        - active
        - is_default
    FolderResource:
      type: object
      properties:
        id:
          type: integer
          example: 42
        name:
          type: string
          example: Campaign Assets
      required:
        - id
        - name
    TagResource:
      type: object
      properties:
        id:
          type: integer
          description: >-
            Tag ID. Use this value in the `tag_ids` array when creating or
            editing a link.
          example: 12
        name:
          type: string
          example: Newsletter
        color:
          type: string
          nullable: true
          description: Hex color associated with the tag.
          example: '#4D977B'
      required:
        - id
        - name
    PixelResource:
      type: object
      properties:
        id:
          type: integer
          example: 9
        name:
          type: string
          example: Shopify Storefront
        unique_id:
          type: string
          example: pix_01HXYZAB12
      required:
        - id
        - name
        - unique_id
    WorkspaceSummary:
      type: object
      properties:
        id:
          type: integer
          example: 24
        name:
          type: string
          example: Marketing
      required:
        - id
        - name
    AnalyticsSummary:
      type: object
      properties:
        url_id:
          type: integer
          example: 501
        url_url:
          type: string
          format: uri
          example: https://example.com/launch
        url_slug_effective:
          type: string
          example: launch-24
        url_created_at:
          type: string
          format: date-time
        event_type:
          type: string
          example: click
        unique_ident:
          type: string
          example: 2f14c06a-d0e4-4f1c-9c0f-3ee94e4c9b9b
        created_at:
          type: string
          format: date-time
      required:
        - url_id
        - event_type
        - unique_ident
        - created_at
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Personal Access Token

````