{
  "openapi": "3.1.0",
  "info": {
    "title": "AI Layoffs automation API",
    "version": "1.0.0",
    "description": "New US WARN notices and new job cuts as triggers, and any company's layoffs by web domain, ticker or name. A free 30-day key is at https://ailayoffs.org/integrations. After the trial the triggers stay on with layoff alerts ($29 a month, or $290 a year); company lookups: $0.04 per lookup that returns a company; lookups that find nothing are free.",
    "contact": {
      "url": "https://ailayoffs.org/integrations"
    }
  },
  "servers": [
    {
      "url": "https://ailayoffs.org/api/v1"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "The key from https://ailayoffs.org/integrations"
      }
    },
    "schemas": {
      "WarnNotice": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable id of the notice (deduplicate on it)"
          },
          "employer": {
            "type": "string",
            "description": "The employer as the notice names it"
          },
          "state": {
            "type": "string",
            "description": "Two-letter US state code"
          },
          "state_name": {
            "type": "string",
            "description": "The state's name"
          },
          "location": {
            "type": [
              "string",
              "null"
            ],
            "description": "The site, as the notice names it"
          },
          "notice_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "effective_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "When the layoff or closure takes effect"
          },
          "jobs": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Jobs the notice states"
          },
          "closure": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "temporary": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "amendment": {
            "type": "boolean"
          },
          "first_seen_at": {
            "type": "string",
            "format": "date-time",
            "description": "When this site first read the notice"
          },
          "page_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "source_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "The state's own WARN page"
          }
        }
      },
      "Layoff": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable id of the cut (deduplicate on it)"
          },
          "company": {
            "type": "string",
            "description": "The employer"
          },
          "announced_on": {
            "type": "string",
            "format": "date"
          },
          "recorded_on": {
            "type": "string",
            "format": "date",
            "description": "When the cut appeared on this site"
          },
          "roles": {
            "type": [
              "integer",
              "null"
            ]
          },
          "roles_note": {
            "type": [
              "string",
              "null"
            ]
          },
          "linked_to_ai": {
            "type": "boolean",
            "description": "True for the register's cuts linked to AI by the employer or by credible reporting"
          },
          "what_the_employer_said": {
            "type": "string",
            "description": "What the employer said about AI, in the register's words"
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "ticker": {
            "type": [
              "string",
              "null"
            ]
          },
          "summary": {
            "type": "string",
            "description": "What was cut, in one or two sentences"
          },
          "page_url": {
            "type": "string",
            "format": "uri"
          },
          "source_name": {
            "type": "string",
            "description": "Who reported or published it"
          },
          "source_url": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    }
  },
  "paths": {
    "/me": {
      "get": {
        "operationId": "me",
        "summary": "The key's own account (connection test)",
        "responses": {
          "200": {
            "description": "Whose key it is, its plan and when it ends"
          },
          "401": {
            "description": "Not a valid key"
          },
          "403": {
            "description": "The key's trial or licence has ended"
          }
        }
      }
    },
    "/warn-notices": {
      "get": {
        "operationId": "listWarnNotices",
        "summary": "New US WARN notices, newest first",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Two-letter state codes, comma-separated",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Words the employer's name holds",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "min_jobs",
            "in": "query",
            "required": false,
            "description": "At least this many jobs",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "description": "First read on or after this day (YYYY-MM-DD, up to 90 days back)",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "At most this many (default 50, up to 200)",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The notices",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "notices": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WarnNotice"
                      }
                    },
                    "count": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/layoffs": {
      "get": {
        "operationId": "listLayoffs",
        "summary": "New job cuts on record worldwide, newest first",
        "parameters": [
          {
            "name": "ai_only",
            "in": "query",
            "required": false,
            "description": "true for the cuts linked to AI only",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "description": "A country as the register names it",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Words the employer's name holds",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "At most this many (default 50, up to 200)",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The cuts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "layoffs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Layoff"
                      }
                    },
                    "count": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/company": {
      "get": {
        "operationId": "findCompanyLayoffs",
        "summary": "One company's job cuts, AI statements and US WARN notices",
        "description": "Send one of domain, ticker or name. $0.04 per lookup that returns a company; lookups that find nothing are free.",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": false,
            "description": "A web domain, URL or email address",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ticker",
            "in": "query",
            "required": false,
            "description": "A stock symbol",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "exchange",
            "in": "query",
            "required": false,
            "description": "The exchange, for a symbol listed in two places",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "query",
            "required": false,
            "description": "A company name",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "matched true with the company's record, or matched false. Fields: https://ailayoffs.org/data/layoffs-api"
          }
        }
      }
    }
  }
}