openapi: 3.1.0
info:
  title: Popcast Signal
  version: 0.1.0
  description: |
    Popcast Signal will summarize what people are talking about in a US Census block group: a rolling word cloud, a sentiment split and the top topics, built from public posts and refreshed daily over 7-, 14- and 30-day windows.

    Two kinds of signal are kept apart. `at-place` comes from posts made inside the block group and reflects the people physically there — the audience that sees out-of-home media in that geography. `residential` comes from posts by people whose home is in the block group and reflects the resident audience. `combined` merges both.

    **Coming soon.** This capability is on the Motionworks roadmap and is not yet available to call. The request and response shapes are published so you can plan an integration; they may change before launch.
  contact:
    name: Motionworks AI
    url: https://mworks.com
    email: api@mworks.com
servers:
  - url: https://api2.mworks.com
    description: Production
tags:
  - name: signal
    description: Word clouds, sentiment and top topics for a block group from public posts. Coming soon.
    x-displayName: Signal
paths: {}
components:
  schemas:
    WordCloudTerm:
      type: object
      required:
        - term
        - frequency
        - sentiment
        - source
      properties:
        term:
          type: string
          description: Extracted topic term or phrase
          example: traffic
        frequency:
          type: number
          format: float
          minimum: 0
          maximum: 100
          description: Normalized frequency score within the window (0–100)
        sentiment:
          type: string
          enum:
            - positive
            - neutral
            - negative
          description: Sentiment of the posts carrying this term.
        source:
          type: string
          enum:
            - reddit
            - yelp
            - google_places
            - combined
          description: Data source this term was primarily extracted from
      description: One term in the word cloud.
    TopTopic:
      type: object
      required:
        - topic
        - post_count
        - sentiment
      properties:
        topic:
          type: string
          example: commute_frustration
          description: Topic label.
        post_count:
          type: integer
          description: Posts about this topic in the window.
        sentiment:
          type: string
          enum:
            - positive
            - neutral
            - negative
          description: Sentiment of the posts about this topic.
      description: One of the most-discussed topics.
    Sentiment:
      type: object
      required:
        - positive_pct
        - neutral_pct
        - negative_pct
      properties:
        positive_pct:
          type: number
          format: float
          minimum: 0
          maximum: 100
          description: Share of items with positive sentiment, as a percentage.
        neutral_pct:
          type: number
          format: float
          minimum: 0
          maximum: 100
          description: Share of items with neutral sentiment, as a percentage.
        negative_pct:
          type: number
          format: float
          minimum: 0
          maximum: 100
          description: Share of items with negative sentiment, as a percentage.
      description: Share of posts by sentiment; the three add up to 100.
    BlockGroupSignal:
      type: object
      required:
        - fips
        - signal_type
        - window_days
        - refreshed_at
        - post_count
        - sentiment
        - word_cloud
        - top_topics
        - data_quality
      properties:
        fips:
          type: string
          pattern: ^\d{12}$
          description: 12-digit US Census block group FIPS code
          example: '130890030001'
        signal_type:
          type: string
          enum:
            - at-place
            - residential
            - combined
          description: Attribution method applied to the returned signal
        window_days:
          type: integer
          enum:
            - 7
            - 14
            - 30
          description: Length of the rolling window, in days (7, 14 or 30).
        refreshed_at:
          type: string
          format: date-time
          description: UTC timestamp of last ingestion refresh
        post_count:
          type: integer
          description: Total posts ingested in the window for this block group
        sentiment:
          $ref: '#/components/schemas/Sentiment'
        word_cloud:
          type: array
          items:
            $ref: '#/components/schemas/WordCloudTerm'
          maxItems: 100
          description: Up to 100 weighted terms.
        top_topics:
          type: array
          items:
            $ref: '#/components/schemas/TopTopic'
          maxItems: 10
          description: Up to 10 top topics.
        data_quality:
          type: string
          enum:
            - high
            - medium
            - low
          default: medium
          description: |
            Confidence band for this signal, parallel to Placecast's
            `is_focused`. Derived from post_count: >=50 = high,
            10-49 = medium, <10 = low. Consumers should down-weight
            'low' signals in aggregate analysis.
      description: The current social signal for one block group.
    SignalResponse:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          $ref: '#/components/schemas/BlockGroupSignal'
        meta:
          $ref: '#/components/schemas/ResponseMeta'
      description: One signal with request metadata.
    SignalHistorySnapshot:
      type: object
      required:
        - period_start
        - period_end
        - fips
        - signal_type
        - post_count
        - sentiment
        - word_cloud
      properties:
        period_start:
          type: string
          format: date
          description: First day of the period this record covers (`YYYY-MM-DD`).
        period_end:
          type: string
          format: date
          description: Last day of the period this record covers (`YYYY-MM-DD`).
        fips:
          type: string
          pattern: ^\d{12}$
          description: 12-digit US Census block group FIPS code.
        signal_type:
          type: string
          enum:
            - at-place
            - residential
            - combined
          description: 'Which signal this snapshot holds: `at-place`, `residential` or `combined`.'
        post_count:
          type: integer
          description: Posts in the period for this block group.
        sentiment:
          $ref: '#/components/schemas/Sentiment'
        word_cloud:
          type: array
          items:
            $ref: '#/components/schemas/WordCloudTerm'
          maxItems: 50
          description: Up to 50 weighted terms for the period.
      description: The signal for one past period.
    SignalHistoryResponse:
      type: object
      required:
        - data
        - pagination
        - meta
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/SignalHistorySnapshot'
          description: The list of results.
        pagination:
          type: object
          properties:
            cursor:
              type: string
              nullable: true
              description: Opaque cursor for the next page. Pass it back as `cursor` to continue; absent on the last page.
            has_more:
              type: boolean
              description: Whether another page follows.
          description: Paging information for the list.
        meta:
          $ref: '#/components/schemas/ResponseMeta'
      description: A page of snapshots with request metadata.
    SignalBatchRequest:
      type: object
      required:
        - fips_codes
      properties:
        fips_codes:
          type: array
          items:
            type: string
            pattern: ^\d{12}$
          minItems: 1
          maxItems: 100
          description: Array of 12-digit block group FIPS codes
        window:
          type: integer
          enum:
            - 7
            - 14
            - 30
          default: 30
          description: Rolling window in days (7, 14 or 30).
        signal_type:
          type: string
          enum:
            - at-place
            - residential
            - combined
          default: combined
          description: 'Which signal to return: `at-place`, `residential` or `combined`.'
        fields:
          type: array
          items:
            type: string
          description: Optional sparse fieldset — return only specified fields per result
      description: Block groups to look up and how to shape the results.
    SignalBatchResponse:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/BlockGroupSignal'
          description: The list of results.
        meta:
          $ref: '#/components/schemas/ResponseMeta'
      description: One signal per requested block group, with request metadata.
    ResponseMeta:
      type: object
      required:
        - request_id
        - credits_used
        - credits_remaining
        - product
        - version
        - provenance
      properties:
        request_id:
          type: string
          description: Unique id for this request. Quote it when contacting support.
        credits_used:
          type: integer
          description: Credits charged for this call.
        credits_remaining:
          type: integer
          description: Credits remaining on your account after this call.
        product:
          type: string
          example: popcast.signal
          description: The Motionworks product that served the call.
        version:
          type: string
          example: 2.0.0
          description: API version that served the call.
        provenance:
          type: object
          description: Where the data came from and how mature it is.
          properties:
            source:
              type: string
              description: The Motionworks dataset or model the result came from.
            source_doc:
              type: string
              format: uri
              description: Link to the methodology or dataset documentation for this result.
            methodology_version:
              type: string
              description: Version of the methodology that produced the result.
            data_vintage:
              type: string
              description: The date the underlying data represents.
            data_freshness:
              type: string
              description: How often the underlying data is refreshed (for example `daily`, `monthly`, `annually`).
            data_latency_days:
              type: integer
              description: Typical days between an observation and its availability in the API.
            data_maturity:
              type: string
              enum:
                - production
                - synthetic-only
                - roadmap
              description: |
                Maturity of the data behind the result: `production` (supported and stable), `research-preview` (available, subject to change), or a pre-release value (`roadmap`, or generated placeholder data not yet backed by production measurement).
      description: Request metadata.
  responses:
    ValidationError:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                properties:
                  code:
                    type: string
                    example: VALIDATION_ERROR
                  message:
                    type: string
                  status:
                    type: integer
                    example: 400
                  request_id:
                    type: string
    NotFound:
      description: Block group not found or no signal available
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                properties:
                  code:
                    type: string
                    example: NOT_FOUND
                  message:
                    type: string
                  status:
                    type: integer
                    example: 404
                  request_id:
                    type: string
    RoadmapNotAvailable:
      description: Roadmap endpoint — not yet available
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                properties:
                  code:
                    type: string
                    example: ROADMAP_NOT_AVAILABLE
                  message:
                    type: string
                  roadmap_issue:
                    type: string
                    example: TF-96
                  status:
                    type: integer
                    example: 501
                  request_id:
                    type: string
x-tagGroups:
  - name: Popcast Signal
    tags:
      - signal
x-customer-voice: true
