{
 "openapi": "3.0.3",
 "info": {
  "title": "ShopMy Influencers API",
  "version": "2.0.0",
  "description": "US ShopMy creators with a public email, TikTok and Instagram handles, their ShopMy profile url, AI niche + location from the bio, and TikTok engagement metrics (posts in 1/7/14/28 days, average/median views, likes, comments, shares, saves, engagement rate). Metrics refresh weekly; every record carries metrics_updated_at."
 },
 "servers": [
  {
   "url": "https://api.tagsify.com"
  }
 ],
 "tags": [
  {
   "name": "ShopMy"
  }
 ],
 "paths": {
  "/v1/shopmy/influencers": {
   "get": {
    "tags": [
     "ShopMy"
    ],
    "operationId": "searchInfluencers",
    "summary": "Search influencers",
    "description": "Filter by niche, location, followers and TikTok metrics; sort and page. format=csv returns a spreadsheet.",
    "parameters": [
     {
      "name": "niche",
      "in": "query",
      "required": false,
      "description": "Comma list of niches (any match by default). Values: fashion, beauty, skincare, hair, nails, home_decor, cleaning_organizing, parenting, family, fitness, wellness, food_cooking, travel, lifestyle, deals_finds, wedding, pets, tech_gadgets, gaming, books, diy_crafts, education, finance, entertainment_comedy, music_dance, sports, outdoors, cars, plus_size_fashion, luxury, thrift_resale, kids_baby_products, none",
      "schema": {
       "type": "string"
      },
      "example": "fashion"
     },
     {
      "name": "niche_mode",
      "in": "query",
      "required": false,
      "description": "any (default) or all",
      "schema": {
       "type": "string",
       "enum": [
        "any",
        "all"
       ]
      }
     },
     {
      "name": "state",
      "in": "query",
      "required": false,
      "description": "Comma list of US states / regions from the bio, e.g. Texas,Florida",
      "schema": {
       "type": "string"
      },
      "example": "Texas"
     },
     {
      "name": "city",
      "in": "query",
      "required": false,
      "description": "Comma list of cities from the bio",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "life_stage",
      "in": "query",
      "required": false,
      "description": "Comma list. Values: mom, dad, expecting, new_parent, engaged, newlywed, married, college_student, high_school, homeschool_parent, military_family, grandparent, empty_nester, retired, single",
      "schema": {
       "type": "string"
      },
      "example": "mom"
     },
     {
      "name": "min_followers",
      "in": "query",
      "required": false,
      "description": "Minimum followers (on followers_on). Plain number or with k/m suffix (10000, 10k, 1m).",
      "schema": {
       "type": "string"
      },
      "example": "10k"
     },
     {
      "name": "max_followers",
      "in": "query",
      "required": false,
      "description": "Maximum followers (on followers_on). Plain number or with k/m suffix (10000, 10k, 1m).",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "followers_on",
      "in": "query",
      "required": false,
      "description": "Which follower count the follower filters use: max (bigger of TikTok/IG, default), tiktok or instagram",
      "schema": {
       "type": "string",
       "enum": [
        "max",
        "tiktok",
        "instagram"
       ]
      }
     },
     {
      "name": "has_instagram",
      "in": "query",
      "required": false,
      "description": "Only influencers with (true) / without (false) an Instagram account",
      "schema": {
       "type": "boolean"
      }
     },
     {
      "name": "q",
      "in": "query",
      "required": false,
      "description": "Free text in name, handles, emails, bios",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "min_avg_views",
      "in": "query",
      "required": false,
      "description": "TikTok: minimum average views per post. Plain number or with k/m suffix (10000, 10k, 1m).",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "min_median_views",
      "in": "query",
      "required": false,
      "description": "TikTok: minimum median views per post. Plain number or with k/m suffix (10000, 10k, 1m).",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "min_avg_likes",
      "in": "query",
      "required": false,
      "description": "TikTok: minimum average likes per post. Plain number or with k/m suffix (10000, 10k, 1m).",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "min_avg_comments",
      "in": "query",
      "required": false,
      "description": "TikTok: minimum average comments per post. Plain number or with k/m suffix (10000, 10k, 1m).",
      "schema": {
       "type": "string"
      },
      "example": "50"
     },
     {
      "name": "min_avg_shares",
      "in": "query",
      "required": false,
      "description": "TikTok: minimum average shares per post. Plain number or with k/m suffix (10000, 10k, 1m).",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "min_avg_saves",
      "in": "query",
      "required": false,
      "description": "TikTok: minimum average saves per post. Plain number or with k/m suffix (10000, 10k, 1m).",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "min_engagement",
      "in": "query",
      "required": false,
      "description": "TikTok: minimum engagement rate in PERCENT ((likes+comments+shares)/views); 5 = 5%",
      "schema": {
       "type": "number"
      }
     },
     {
      "name": "metrics_window",
      "in": "query",
      "required": false,
      "description": "Window for the average/engagement filters: all analyzed posts (default) or last_28d",
      "schema": {
       "type": "string",
       "enum": [
        "all",
        "last_28d"
       ]
      }
     },
     {
      "name": "min_posts_1d",
      "in": "query",
      "required": false,
      "description": "TikTok: minimum posts in the last 24 hours",
      "schema": {
       "type": "integer"
      }
     },
     {
      "name": "min_posts_7d",
      "in": "query",
      "required": false,
      "description": "TikTok: minimum posts in the last 7 days",
      "schema": {
       "type": "integer"
      }
     },
     {
      "name": "min_posts_14d",
      "in": "query",
      "required": false,
      "description": "TikTok: minimum posts in the last 14 days",
      "schema": {
       "type": "integer"
      }
     },
     {
      "name": "min_posts_28d",
      "in": "query",
      "required": false,
      "description": "TikTok: minimum posts in the last 28 days",
      "schema": {
       "type": "integer"
      }
     },
     {
      "name": "posted_within_days",
      "in": "query",
      "required": false,
      "description": "TikTok: last post at most N days ago",
      "schema": {
       "type": "integer"
      },
      "example": 7
     },
     {
      "name": "has_metrics",
      "in": "query",
      "required": false,
      "description": "Only influencers with (true) / without (false) TikTok metrics",
      "schema": {
       "type": "boolean"
      }
     },
     {
      "name": "sort",
      "in": "query",
      "required": false,
      "description": "Sort order. top = engagement, with creators that have 1k+ median views and 2+ posts in 28 days first",
      "schema": {
       "type": "string",
       "enum": [
        "top",
        "followers_desc",
        "followers_asc",
        "tiktok_desc",
        "instagram_desc",
        "name",
        "avg_views_desc",
        "median_views_desc",
        "avg_likes_desc",
        "avg_comments_desc",
        "avg_shares_desc",
        "avg_saves_desc",
        "engagement_desc",
        "posts_7d_desc",
        "posts_28d_desc",
        "last_post_desc"
       ]
      },
      "example": "top"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "description": "Page size, 1-1000 (default 50)",
      "schema": {
       "type": "integer"
      },
      "example": 20
     },
     {
      "name": "offset",
      "in": "query",
      "required": false,
      "description": "Start index; use next_offset from the previous page",
      "schema": {
       "type": "integer"
      }
     },
     {
      "name": "full",
      "in": "query",
      "required": false,
      "description": "Add a 'details' object (bios, all emails, links)",
      "schema": {
       "type": "boolean"
      }
     },
     {
      "name": "format",
      "in": "query",
      "required": false,
      "description": "json (default) or csv (all matching rows, max 100,000)",
      "schema": {
       "type": "string",
       "enum": [
        "json",
        "csv"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "total": {
           "type": "integer"
          },
          "offset": {
           "type": "integer"
          },
          "limit": {
           "type": "integer"
          },
          "next_offset": {
           "type": "integer",
           "nullable": true
          },
          "profile_updated_at": {
           "type": "string"
          },
          "metrics_updated": {
           "type": "object",
           "properties": {
            "creators_with_metrics": {
             "type": "integer"
            },
            "oldest": {
             "type": "string",
             "nullable": true
            },
            "newest": {
             "type": "string",
             "nullable": true
            }
           }
          },
          "items": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Influencer"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad parameter",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/shopmy/influencers/{id}": {
   "get": {
    "tags": [
     "ShopMy"
    ],
    "operationId": "getInfluencer",
    "summary": "One influencer (with details)",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "Influencer id",
      "example": 223329
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Influencer"
        }
       }
      }
     },
     "400": {
      "description": "Bad parameter",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/shopmy/influencers/{id}/metrics": {
   "get": {
    "tags": [
     "ShopMy"
    ],
    "operationId": "getInfluencerMetrics",
    "summary": "All TikTok metrics",
    "description": "Post counts for 1/7/14/28 days; averages and medians for all analyzed posts ('all') and the last 28 days ('last_28d').",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "Influencer id",
      "example": 223329
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Bad parameter",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/shopmy/influencers/{id}/posts": {
   "get": {
    "tags": [
     "ShopMy"
    ],
    "operationId": "getInfluencerPosts",
    "summary": "Latest TikTok posts with interactions",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "integer"
      },
      "description": "Influencer id",
      "example": 223329
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "id": {
           "type": "integer"
          },
          "name": {
           "type": "string",
           "nullable": true
          },
          "tiktok": {
           "type": "string",
           "nullable": true
          },
          "metrics_updated_at": {
           "type": "string",
           "nullable": true
          },
          "total": {
           "type": "integer"
          },
          "posts": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Post"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad parameter",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/shopmy/lookup": {
   "get": {
    "tags": [
     "ShopMy"
    ],
    "operationId": "lookupInfluencer",
    "summary": "Find by handle or email",
    "parameters": [
     {
      "name": "shopmy",
      "in": "query",
      "required": false,
      "description": "ShopMy handle or curator id",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "instagram",
      "in": "query",
      "required": false,
      "description": "Instagram handle",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "tiktok",
      "in": "query",
      "required": false,
      "description": "TikTok handle",
      "schema": {
       "type": "string"
      },
      "example": "emmycombss"
     },
     {
      "name": "email",
      "in": "query",
      "required": false,
      "description": "Email address",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "total": {
           "type": "integer"
          },
          "items": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Influencer"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad parameter",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/shopmy/facets": {
   "get": {
    "tags": [
     "ShopMy"
    ],
    "operationId": "getFacets",
    "summary": "Filter values with counts (niches, states, cities, life stages)",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Bad parameter",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/shopmy/stats": {
   "get": {
    "tags": [
     "ShopMy"
    ],
    "operationId": "getStats",
    "summary": "Totals, follower bands, metrics coverage and freshness",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Bad parameter",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  }
 },
 "components": {
  "schemas": {
   "Account": {
    "type": "object",
    "nullable": true,
    "properties": {
     "handle": {
      "type": "string"
     },
     "url": {
      "type": "string"
     },
     "followers": {
      "type": "integer",
      "nullable": true
     }
    }
   },
   "MetricsSummary": {
    "type": "object",
    "nullable": true,
    "description": "TikTok, from the latest posts (one pull: up to 35 posts, pinned excluded)",
    "properties": {
     "posts_1d": {
      "type": "integer"
     },
     "posts_7d": {
      "type": "integer"
     },
     "posts_14d": {
      "type": "integer"
     },
     "posts_28d": {
      "type": "integer"
     },
     "last_post_at": {
      "type": "string",
      "nullable": true
     },
     "days_since_last_post": {
      "type": "number",
      "nullable": true
     },
     "avg_views": {
      "type": "number",
      "nullable": true
     },
     "median_views": {
      "type": "number",
      "nullable": true
     },
     "avg_likes": {
      "type": "number",
      "nullable": true
     },
     "avg_comments": {
      "type": "number",
      "nullable": true
     },
     "avg_shares": {
      "type": "number",
      "nullable": true
     },
     "avg_saves": {
      "type": "number",
      "nullable": true
     },
     "engagement_rate": {
      "type": "number",
      "nullable": true,
      "description": "(likes+comments+shares)/views, 0.05 = 5%"
     },
     "posts_analyzed": {
      "type": "integer"
     },
     "posts_capped": {
      "type": "boolean",
      "description": "true = posts returned do not reach back 28 days; counts are minimums"
     }
    }
   },
   "Influencer": {
    "type": "object",
    "properties": {
     "id": {
      "type": "integer"
     },
     "name": {
      "type": "string",
      "nullable": true
     },
     "niche": {
      "type": "string",
      "nullable": true
     },
     "niches": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "city": {
      "type": "string",
      "nullable": true
     },
     "state": {
      "type": "string",
      "nullable": true
     },
     "country": {
      "type": "string",
      "nullable": true
     },
     "email": {
      "type": "string"
     },
     "instagram": {
      "$ref": "#/components/schemas/Account"
     },
     "tiktok": {
      "$ref": "#/components/schemas/Account"
     },
     "shopmy_url": {
      "type": "string",
      "description": "ShopMy profile url"
     },
     "tiktok_metrics": {
      "$ref": "#/components/schemas/MetricsSummary"
     },
     "metrics_updated_at": {
      "type": "string",
      "nullable": true,
      "description": "When this influencer's TikTok metrics were pulled (UTC)"
     },
     "metrics_status": {
      "type": "string",
      "enum": [
       "ok",
       "no_data",
       "not_pulled"
      ]
     },
     "profile_updated_at": {
      "type": "string",
      "description": "When profile data (niche, email, handles) was rebuilt"
     }
    }
   },
   "Post": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "created_at": {
      "type": "string"
     },
     "views": {
      "type": "integer"
     },
     "likes": {
      "type": "integer"
     },
     "comments": {
      "type": "integer"
     },
     "shares": {
      "type": "integer"
     },
     "saves": {
      "type": "integer"
     },
     "duration_s": {
      "type": "integer"
     },
     "type": {
      "type": "string",
      "enum": [
       "video",
       "photo"
      ]
     },
     "pinned": {
      "type": "boolean"
     },
     "ad": {
      "type": "boolean"
     },
     "caption": {
      "type": "string"
     },
     "url": {
      "type": "string"
     }
    }
   },
   "Error": {
    "type": "object",
    "properties": {
     "error": {
      "type": "string"
     }
    }
   }
  }
 }
}