> ## Documentation Index
> Fetch the complete documentation index at: https://docs.withmithras.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create maintenance request

> Create an account-first maintenance process. Omit platform for TikTok; set platform to instagram for Instagram profile maintenance.



## OpenAPI

````yaml /openapi.json post /maintenance/requests
openapi: 3.1.0
info:
  title: Phonefarm Public API
  description: >-
    Process-first public API for externally triggered Phonefarm execution across
    TikTok and Instagram.
  version: '2026-05-09'
servers:
  - url: https://phonefarm.withmithras.com
security:
  - bearerAuth: []
paths:
  /maintenance/requests:
    post:
      tags:
        - Processes
      summary: Create maintenance request
      description: >-
        Create an account-first maintenance process. Omit platform for TikTok;
        set platform to instagram for Instagram profile maintenance.
      operationId: createMaintenanceRequest
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MaintenanceRequest'
      responses:
        '200':
          description: Duplicate request; existing process returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DuplicateProcess'
        '202':
          description: Maintenance process accepted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AcceptedProcess'
        '401':
          description: Missing or invalid bearer token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Requested process, account, or queue item was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Invalid request payload.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Unexpected runtime, environment, or database failure.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    MaintenanceRequest:
      type: object
      properties:
        request_id:
          type: string
          minLength: 1
        platform:
          type: string
          enum:
            - tiktok
            - instagram
          default: tiktok
        account_id:
          type: string
          minLength: 1
        inputs:
          $ref: '#/components/schemas/MaintenanceInputs'
        callback:
          $ref: '#/components/schemas/Callback'
        requested_by:
          $ref: '#/components/schemas/RequestedBy'
      required:
        - request_id
        - account_id
        - inputs
        - callback
        - requested_by
    DuplicateProcess:
      allOf:
        - $ref: '#/components/schemas/AcceptedProcess'
        - type: object
          properties:
            duplicate:
              type: boolean
              const: true
            process_status:
              $ref: '#/components/schemas/PublicProcessStatus'
          required:
            - duplicate
            - process_status
    AcceptedProcess:
      type: object
      properties:
        status:
          type: string
          const: accepted
        process_id:
          type: string
          format: uuid
        request_id:
          type: string
        process_type:
          type: string
        platform:
          type: string
          enum:
            - tiktok
            - instagram
      required:
        - status
        - process_id
        - request_id
        - process_type
        - platform
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        details:
          type: object
          additionalProperties: true
      required:
        - error
    MaintenanceInputs:
      type: object
      properties:
        steps:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/MaintenanceStep'
        metadata:
          type: object
          additionalProperties: true
      required:
        - steps
    Callback:
      type: object
      properties:
        url:
          type: string
          format: uri
        metadata:
          type: object
          additionalProperties: true
      required:
        - url
    RequestedBy:
      type: object
      properties:
        system:
          type: string
          minLength: 1
        user:
          type:
            - string
            - 'null'
        metadata:
          type: object
          additionalProperties: true
      required:
        - system
    PublicProcessStatus:
      type: string
      enum:
        - queued
        - executing
        - retrying
        - completed
        - failed_terminal
        - cancelled
    MaintenanceStep:
      type: object
      properties:
        action:
          type: string
          enum:
            - edit_profile
        params:
          type: object
          additionalProperties: true
      required:
        - action
        - params
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      x-default: PHONEFARM_API_KEY

````