Coppica Learning loop API

Extract techniques and report outcomes.

GitHub OpenAPI

Operations 5

POST /extract Extract persuasion techniques from arbitrary copy #
POST /outcomes Report an outcome against an output_id (the flagship loop primitive) #
GET /clients/{clientId}/outcomes Audit log of outcomes this key reported #
POST /clients/{clientId}/ad-outcomes Report what happened after the lead, per Meta ad #
GET /clients/{clientId}/ad-outcomes What Coppica holds from ad-outcomes, per ad and stage #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/coppica-com:coppica-com-learning-loop-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

coppica-com-learning-loop-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Coppica Com Learning loop API
  version: v1-alpha
  description: 'Operations tagged Learning loop across 2 of this provider''s published API definitions: coppica-com-openapi.json, coppica-com-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: https://coppica.com/api/v1
security:
- bearerAuth: []
tags:
- name: Learning loop
  description: Extract techniques and report outcomes.
paths:
  /extract:
    post:
      tags:
      - Learning loop
      summary: Extract persuasion techniques from arbitrary copy
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExtractRequest'
      responses:
        '200':
          description: Extracted techniques. When persist=true, output_id is returned so you can later report outcomes against it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExtractResult'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
      operationId: postExtract
      x-operation-id-source: derived
    servers:
    - url: https://coppica.com/api/v1
  /outcomes:
    post:
      tags:
      - Learning loop
      summary: Report an outcome against an output_id (the flagship loop primitive)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OutcomeRequest'
      responses:
        '200':
          description: Idempotent replay — the same (output_id, external_id) was already reported. Same body shape as 201.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OutcomeResult'
        '201':
          description: Outcome recorded; weight update queued asynchronously.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OutcomeResult'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
      operationId: postOutcomes
      x-operation-id-source: derived
    servers:
    - url: https://coppica.com/api/v1
  /clients/{clientId}/outcomes:
    get:
      tags:
      - Learning loop
      summary: Audit log of outcomes this key reported
      parameters:
      - name: clientId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: limit
        in: query
        required: false
        description: Max rows to return (1–500, default 100).
        schema:
          type: integer
          minimum: 1
          maximum: 500
          default: 100
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
      responses:
        '200':
          description: Outcomes reported by this key for the client.
          content:
            application/json:
              schema:
                type: object
                properties:
                  outcomes:
                    type: array
                    items:
                      $ref: '#/components/schemas/Generic'
                  pagination:
                    type: object
                    properties:
                      limit:
                        type: integer
                      offset:
                        type: integer
                      returned:
                        type: integer
                required:
                - outcomes
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
      operationId: getClientsByClientIdOutcomes
      x-operation-id-source: derived
    servers:
    - url: https://coppica.com/api/v1
  /clients/{clientId}/ad-outcomes:
    post:
      tags:
      - Learning loop
      summary: Report what happened after the lead, per Meta ad
      description: 'Each step a lead takes after a Meta ad brought it in (contacted, qualified, booked, showed) and the sale itself (signed, won, sold), from the client''s own CRM or intake tool. Every outcome joins the conversion ledger tagged with its ad: Heimdall credits the ad, the writing bots rank the client''s winners by cost per sale, and the ad''s techniques gain weight overnight. One event per lead and stage: resending the same lead_id and stage replaces it. Events that fail validation come back in `rejected` and the rest are recorded; if none can be, the response is 422.'
      parameters:
      - name: clientId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - events
              properties:
                events:
                  type: array
                  minItems: 1
                  maxItems: 500
                  items:
                    type: object
                    required:
                    - lead_id
                    - stage
                    - ad_id
                    - occurred_at
                    properties:
                      lead_id:
                        type: string
                        maxLength: 200
                        description: Your system's ID for the lead or case. Not an email address or phone number. Case-insensitive.
                      stage:
                        type: string
                        enum:
                        - contacted
                        - qualified
                        - booked
                        - showed
                        - signed
                        - won
                        - sold
                        description: signed, won and sold are the sale.
                      ad_id:
                        type: string
                        pattern: ^[0-9]{5,30}$
                        description: The Meta ad ID the lead came from, as a string (Meta IDs exceed what a JSON number holds exactly).
                      occurred_at:
                        type: string
                        format: date-time
                        description: When the stage happened; within the last 365 days.
                      value:
                        type: number
                        minimum: 0
                        description: 'Sales only: what the sale is worth, e.g. a case payout.'
                      currency:
                        type: string
                        pattern: ^[A-Za-z]{3}$
                        default: USD
                      retracted:
                        type: boolean
                        description: true takes this lead and stage out of every report.
      responses:
        '200':
          description: Recorded. Rejected events, if any, are listed with their reasons.
          content:
            application/json:
              schema:
                type: object
                properties:
                  accepted:
                    type: integer
                  retracted:
                    type: integer
                  rejected:
                    type: array
                    items:
                      type: object
                      properties:
                        index:
                          type: integer
                        lead_id:
                          type:
                          - string
                          - 'null'
                        code:
                          type: string
                        error:
                          type: string
                  duplicates_in_request:
                    type: integer
                    description: Events replaced by a later event for the same lead and stage in this request.
                  values_ignored:
                    type: integer
                    description: Values sent on stages other than the sale.
                  unmatched_ad_ids:
                    type:
                    - array
                    - 'null'
                    items:
                      type: string
                    description: Ad IDs that match no ad synced from the client's Meta account. Their outcomes are kept.
                required:
                - accepted
                - rejected
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          description: No event in the request could be recorded; see rejected.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Generic'
        '429':
          $ref: '#/components/responses/RateLimited'
      operationId: postClientsByClientIdAdOutcomes
      x-operation-id-source: derived
    get:
      tags:
      - Learning loop
      summary: What Coppica holds from ad-outcomes, per ad and stage
      parameters:
      - name: clientId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: days
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          maximum: 730
          default: 90
      responses:
        '200':
          description: Totals per stage, each ad with its stages, and unmatched ad IDs. Retracted outcomes are left out.
          content:
            application/json:
              schema:
                type: object
                properties:
                  window_days:
                    type: integer
                  totals:
                    type: object
                    additionalProperties:
                      type: number
                  sale_value:
                    type: number
                  latest_occurred_at:
                    type:
                    - string
                    - 'null'
                    format: date-time
                  ads_total:
                    type: integer
                  ads:
                    type: array
                    items:
                      type: object
                      properties:
                        ad_id:
                          type: string
                        ad_name:
                          type:
                          - string
                          - 'null'
                        campaign:
                          type:
                          - string
                          - 'null'
                        matched:
                          type: boolean
                        stages:
                          type: object
                          additionalProperties:
                            type: number
                        sale_value:
                          type: number
                  unmatched_ad_ids:
                    type: array
                    items:
                      type: string
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
      operationId: getClientsByClientIdAdOutcomes
      x-operation-id-source: derived
    servers:
    - url: https://coppica.com/api/v1
components:
  schemas:
    ExtractRequest:
      type: object
      properties:
        client_id:
          type: string
          format: uuid
        text:
          type: string
          description: The copy to analyze. Required unless output_id is given.
        output_id:
          type: string
          format: uuid
          description: Tag an output that already exists for this client (for example a writing run before it launches). Its techniques are stored against it, so diagnose returns them. Uses the output's own copy when text is omitted. Cannot be combined with persist:false.
        context_hint:
          type: string
          maxLength: 500
          description: Optional context, e.g. "a Facebook ad for a chiropractor".
        label:
          type: string
          description: Optional label for the stored output.
        persist:
          type: boolean
          default: true
          description: Store a bot_outputs row so you can report outcomes against the returned output_id.
      required:
      - client_id
    Error:
      type: object
      description: Standard error envelope. Branch on `code`, never the human `error` string.
      properties:
        error:
          type: string
          description: Human-readable, sanitized message.
        code:
          type: string
          description: Stable machine-readable code.
          examples:
          - invalid_request
          - invalid_client_id
          - missing_authorization
          - invalid_api_key
          - missing_scope
          - client_access_denied
          - spending_cap_exceeded
          - not_found
          - rate_limited
          - server_error
      required:
      - error
      - code
    OutcomeResult:
      type: object
      properties:
        outcome_id:
          type: string
          format: uuid
        output_id:
          type: string
          format: uuid
        type:
          type: string
        weights_updated:
          type: integer
          description: Always 0 on the synchronous response; the update runs async.
        weight_update_queued:
          type: boolean
          description: 'True only when status is clean: the outcome will move technique weights.'
        status:
          type: string
          description: clean trains the model; flagged (over 90 days old) and rejected (dated before its output existed) are recorded but do not.
        echo:
          type: object
          properties:
            output_id:
              type: string
            type:
              type: string
            value:
              type:
              - number
              - 'null'
            external_id:
              type:
              - string
              - 'null'
            anomaly_flagged:
              type: boolean
      required:
      - outcome_id
      - output_id
      - type
      - weight_update_queued
      - status
    Generic:
      type: object
      additionalProperties: true
    OutcomeRequest:
      type: object
      properties:
        output_id:
          type: string
          format: uuid
        type:
          type: string
          enum:
          - conversion_purchase
          - conversion_lead
          - conversion_signup
          - conversion_custom
          - engagement_positive
          - engagement_negative
          - thumbs_up
          - thumbs_down
        value:
          type: number
          description: Dollar value for conversions.
        external_id:
          type: string
          description: Your stable event id. Refiring with the same (output_id, external_id) from the same key returns the original (200, deduplicated). For conversion_purchase, conversion_lead and conversion_signup, an id the client already has from any source (compared lowercased + trimmed) is refused with 409; conversion_custom gets no such check.
        occurred_at:
          type: string
          format: date-time
          description: 'When it happened; defaults to now. More than 5 minutes ahead or more than a year old is refused with a 400. Dated before the output was created: recorded as rejected. More than 90 days old: recorded as flagged. Neither moves technique weights.'
        metadata:
          type: object
          additionalProperties: true
      required:
      - output_id
      - type
    ExtractResult:
      type: object
      properties:
        output_id:
          type: string
          format: uuid
          description: Present only when persist=true.
        elements:
          type: array
          items:
            type: object
            additionalProperties: true
        elements_count:
          type: integer
        credits_spent:
          type: number
          description: Credits consumed by this extraction.
        persisted:
          type: boolean
      required:
      - elements
      - elements_count
      - persisted
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found (also returned when access is denied).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Rate limit exceeded.
      headers:
        Retry-After:
          schema:
            type: integer
          description: Seconds to wait before retrying.
        RateLimit-Limit:
          schema:
            type: integer
          description: Max requests in the window.
        RateLimit-Remaining:
          schema:
            type: integer
          description: Requests left in the window.
        RateLimit-Reset:
          schema:
            type: integer
          description: Seconds until the window resets.
      content:
        application/json:
          schema:
            type: object
            description: The 429 body carries code plus a message and retryAfterMs.
            properties:
              error:
                type: string
              code:
                type: string
                const: rate_limited
              message:
                type: string
              retryAfterMs:
                type: integer
            required:
            - error
            - code
    Forbidden:
      description: Wrong scope, client access denied, or spending cap exceeded.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'A Coppica API key, e.g. `Authorization: Bearer cpk_...`. Keys carry read/write/execute scopes.'
x-refined-from:
- coppica-com-openapi.json
- coppica-com-openapi.yml