openapi: "3.1.0"
info:
  title: "CRM & Sales API"
  version: "1.0.0"
  description: "Contacts, deals, activities, pipeline, and company account flows Exported as an OpenAPI 3.1 document from Fake API for Devs."
servers:
  - url: "https://fakeapifordevs.vercel.app"
        description: "Fake API for Devs production endpoint"
tags:
  - name: "CRM & Sales"
        description: "Contacts, deals, activities, pipeline, and company account flows"
paths:
  /api/crm/contacts:
    get:
      tags:
        - "CRM & Sales"
      summary: "GET /api/crm/contacts"
      operationId: "crm_get_crm_contacts"
      parameters:
        - name: "page"
                    in: "query"
                    schema:
                      type: "integer"
                      minimum: 1
                      default: 1
                    description: "1-indexed page number for collection endpoints."
        - name: "per_page"
                    in: "query"
                    schema:
                      type: "integer"
                      minimum: 1
                      maximum: 50
                      default: 10
                    description: "Page size for collection endpoints."
        - name: "q"
                    in: "query"
                    schema:
                      type: "string"
                    description: "Optional text search filter where supported."
        - name: "delay"
                    in: "query"
                    schema:
                      type: "number"
                      minimum: 0
                      maximum: 10
                    description: "Optional artificial delay in seconds."
        - name: "simulate_error"
                    in: "query"
                    schema:
                      type: "string"
                      enum:
                        - "rate_limit"
                        - "server_error"
                        - "not_found"
                        - "unauthorized"
                        - "forbidden"
                        - "bad_request"
                        - "service_unavailable"
                        - "timeout"
                        - "malformed"
                    description: "Force a mock failure scenario for resilience testing."
      responses:
        200:
          description: "Successful response"
          content:
            application/json:
              schema:
                type: "object"
        400:
          description: "Bad request"
        401:
          description: "Unauthorized"
        404:
          description: "Not found"
        429:
          description: "Rate limited"
        500:
          description: "Internal server error"
    post:
      tags:
        - "CRM & Sales"
      summary: "POST /api/crm/contacts"
      operationId: "crm_post_crm_contacts"
      parameters:
        []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
            example:
              first_name: "Jamie"
              last_name: "Chen"
              email: "jamie.chen@acme.com"
              company_id: "company_001"
              owner_id: "owner_001"
              status: "lead"
      responses:
        200:
          description: "Successful response"
          content:
            application/json:
              schema:
                type: "object"
        400:
          description: "Bad request"
        401:
          description: "Unauthorized"
        404:
          description: "Not found"
        429:
          description: "Rate limited"
        500:
          description: "Internal server error"
  /api/crm/contacts/contact_001:
    get:
      tags:
        - "CRM & Sales"
      summary: "GET /api/crm/contacts/contact_001"
      operationId: "crm_get_crm_contacts_contact_001"
      parameters:
        - name: "page"
                    in: "query"
                    schema:
                      type: "integer"
                      minimum: 1
                      default: 1
                    description: "1-indexed page number for collection endpoints."
        - name: "per_page"
                    in: "query"
                    schema:
                      type: "integer"
                      minimum: 1
                      maximum: 50
                      default: 10
                    description: "Page size for collection endpoints."
        - name: "q"
                    in: "query"
                    schema:
                      type: "string"
                    description: "Optional text search filter where supported."
        - name: "delay"
                    in: "query"
                    schema:
                      type: "number"
                      minimum: 0
                      maximum: 10
                    description: "Optional artificial delay in seconds."
        - name: "simulate_error"
                    in: "query"
                    schema:
                      type: "string"
                      enum:
                        - "rate_limit"
                        - "server_error"
                        - "not_found"
                        - "unauthorized"
                        - "forbidden"
                        - "bad_request"
                        - "service_unavailable"
                        - "timeout"
                        - "malformed"
                    description: "Force a mock failure scenario for resilience testing."
      responses:
        200:
          description: "Successful response"
          content:
            application/json:
              schema:
                type: "object"
        400:
          description: "Bad request"
        401:
          description: "Unauthorized"
        404:
          description: "Not found"
        429:
          description: "Rate limited"
        500:
          description: "Internal server error"
  /api/crm/deals:
    get:
      tags:
        - "CRM & Sales"
      summary: "GET /api/crm/deals"
      operationId: "crm_get_crm_deals"
      parameters:
        - name: "page"
                    in: "query"
                    schema:
                      type: "integer"
                      minimum: 1
                      default: 1
                    description: "1-indexed page number for collection endpoints."
        - name: "per_page"
                    in: "query"
                    schema:
                      type: "integer"
                      minimum: 1
                      maximum: 50
                      default: 10
                    description: "Page size for collection endpoints."
        - name: "q"
                    in: "query"
                    schema:
                      type: "string"
                    description: "Optional text search filter where supported."
        - name: "delay"
                    in: "query"
                    schema:
                      type: "number"
                      minimum: 0
                      maximum: 10
                    description: "Optional artificial delay in seconds."
        - name: "simulate_error"
                    in: "query"
                    schema:
                      type: "string"
                      enum:
                        - "rate_limit"
                        - "server_error"
                        - "not_found"
                        - "unauthorized"
                        - "forbidden"
                        - "bad_request"
                        - "service_unavailable"
                        - "timeout"
                        - "malformed"
                    description: "Force a mock failure scenario for resilience testing."
      responses:
        200:
          description: "Successful response"
          content:
            application/json:
              schema:
                type: "object"
        400:
          description: "Bad request"
        401:
          description: "Unauthorized"
        404:
          description: "Not found"
        429:
          description: "Rate limited"
        500:
          description: "Internal server error"
    post:
      tags:
        - "CRM & Sales"
      summary: "POST /api/crm/deals"
      operationId: "crm_post_crm_deals"
      parameters:
        []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
            example:
              title: "Platform rollout for Acme Corp"
              value: 48000
              company_id: "company_001"
              contact_id: "contact_001"
              owner_id: "owner_001"
              stage: "proposal"
      responses:
        200:
          description: "Successful response"
          content:
            application/json:
              schema:
                type: "object"
        400:
          description: "Bad request"
        401:
          description: "Unauthorized"
        404:
          description: "Not found"
        429:
          description: "Rate limited"
        500:
          description: "Internal server error"
  /api/crm/deals/deal_001:
    get:
      tags:
        - "CRM & Sales"
      summary: "GET /api/crm/deals/deal_001"
      operationId: "crm_get_crm_deals_deal_001"
      parameters:
        - name: "page"
                    in: "query"
                    schema:
                      type: "integer"
                      minimum: 1
                      default: 1
                    description: "1-indexed page number for collection endpoints."
        - name: "per_page"
                    in: "query"
                    schema:
                      type: "integer"
                      minimum: 1
                      maximum: 50
                      default: 10
                    description: "Page size for collection endpoints."
        - name: "q"
                    in: "query"
                    schema:
                      type: "string"
                    description: "Optional text search filter where supported."
        - name: "delay"
                    in: "query"
                    schema:
                      type: "number"
                      minimum: 0
                      maximum: 10
                    description: "Optional artificial delay in seconds."
        - name: "simulate_error"
                    in: "query"
                    schema:
                      type: "string"
                      enum:
                        - "rate_limit"
                        - "server_error"
                        - "not_found"
                        - "unauthorized"
                        - "forbidden"
                        - "bad_request"
                        - "service_unavailable"
                        - "timeout"
                        - "malformed"
                    description: "Force a mock failure scenario for resilience testing."
      responses:
        200:
          description: "Successful response"
          content:
            application/json:
              schema:
                type: "object"
        400:
          description: "Bad request"
        401:
          description: "Unauthorized"
        404:
          description: "Not found"
        429:
          description: "Rate limited"
        500:
          description: "Internal server error"
    patch:
      tags:
        - "CRM & Sales"
      summary: "PATCH /api/crm/deals/deal_001"
      operationId: "crm_patch_crm_deals_deal_001"
      parameters:
        []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: "object"
            example:
              stage: "negotiation"
      responses:
        200:
          description: "Successful response"
          content:
            application/json:
              schema:
                type: "object"
        400:
          description: "Bad request"
        401:
          description: "Unauthorized"
        404:
          description: "Not found"
        429:
          description: "Rate limited"
        500:
          description: "Internal server error"
  /api/crm/pipeline:
    get:
      tags:
        - "CRM & Sales"
      summary: "GET /api/crm/pipeline"
      operationId: "crm_get_crm_pipeline"
      parameters:
        - name: "page"
                    in: "query"
                    schema:
                      type: "integer"
                      minimum: 1
                      default: 1
                    description: "1-indexed page number for collection endpoints."
        - name: "per_page"
                    in: "query"
                    schema:
                      type: "integer"
                      minimum: 1
                      maximum: 50
                      default: 10
                    description: "Page size for collection endpoints."
        - name: "q"
                    in: "query"
                    schema:
                      type: "string"
                    description: "Optional text search filter where supported."
        - name: "delay"
                    in: "query"
                    schema:
                      type: "number"
                      minimum: 0
                      maximum: 10
                    description: "Optional artificial delay in seconds."
        - name: "simulate_error"
                    in: "query"
                    schema:
                      type: "string"
                      enum:
                        - "rate_limit"
                        - "server_error"
                        - "not_found"
                        - "unauthorized"
                        - "forbidden"
                        - "bad_request"
                        - "service_unavailable"
                        - "timeout"
                        - "malformed"
                    description: "Force a mock failure scenario for resilience testing."
      responses:
        200:
          description: "Successful response"
          content:
            application/json:
              schema:
                type: "object"
        400:
          description: "Bad request"
        401:
          description: "Unauthorized"
        404:
          description: "Not found"
        429:
          description: "Rate limited"
        500:
          description: "Internal server error"
  /api/crm/activities:
    get:
      tags:
        - "CRM & Sales"
      summary: "GET /api/crm/activities"
      operationId: "crm_get_crm_activities"
      parameters:
        - name: "page"
                    in: "query"
                    schema:
                      type: "integer"
                      minimum: 1
                      default: 1
                    description: "1-indexed page number for collection endpoints."
        - name: "per_page"
                    in: "query"
                    schema:
                      type: "integer"
                      minimum: 1
                      maximum: 50
                      default: 10
                    description: "Page size for collection endpoints."
        - name: "q"
                    in: "query"
                    schema:
                      type: "string"
                    description: "Optional text search filter where supported."
        - name: "delay"
                    in: "query"
                    schema:
                      type: "number"
                      minimum: 0
                      maximum: 10
                    description: "Optional artificial delay in seconds."
        - name: "simulate_error"
                    in: "query"
                    schema:
                      type: "string"
                      enum:
                        - "rate_limit"
                        - "server_error"
                        - "not_found"
                        - "unauthorized"
                        - "forbidden"
                        - "bad_request"
                        - "service_unavailable"
                        - "timeout"
                        - "malformed"
                    description: "Force a mock failure scenario for resilience testing."
      responses:
        200:
          description: "Successful response"
          content:
            application/json:
              schema:
                type: "object"
        400:
          description: "Bad request"
        401:
          description: "Unauthorized"
        404:
          description: "Not found"
        429:
          description: "Rate limited"
        500:
          description: "Internal server error"
  /api/crm/companies:
    get:
      tags:
        - "CRM & Sales"
      summary: "GET /api/crm/companies"
      operationId: "crm_get_crm_companies"
      parameters:
        - name: "page"
                    in: "query"
                    schema:
                      type: "integer"
                      minimum: 1
                      default: 1
                    description: "1-indexed page number for collection endpoints."
        - name: "per_page"
                    in: "query"
                    schema:
                      type: "integer"
                      minimum: 1
                      maximum: 50
                      default: 10
                    description: "Page size for collection endpoints."
        - name: "q"
                    in: "query"
                    schema:
                      type: "string"
                    description: "Optional text search filter where supported."
        - name: "delay"
                    in: "query"
                    schema:
                      type: "number"
                      minimum: 0
                      maximum: 10
                    description: "Optional artificial delay in seconds."
        - name: "simulate_error"
                    in: "query"
                    schema:
                      type: "string"
                      enum:
                        - "rate_limit"
                        - "server_error"
                        - "not_found"
                        - "unauthorized"
                        - "forbidden"
                        - "bad_request"
                        - "service_unavailable"
                        - "timeout"
                        - "malformed"
                    description: "Force a mock failure scenario for resilience testing."
      responses:
        200:
          description: "Successful response"
          content:
            application/json:
              schema:
                type: "object"
        400:
          description: "Bad request"
        401:
          description: "Unauthorized"
        404:
          description: "Not found"
        429:
          description: "Rate limited"
        500:
          description: "Internal server error"