{
  "openapi": "3.1.0",
  "info": {
    "title": "CraftMyResume Business Synthetic Sandbox",
    "version": "1.0.0",
    "description": "Current free sandbox contract. Fixed fixtures only, ten lifetime runs per organization, sixty requests per organization per minute, two active sandbox keys, 24-hour results. This is distinct from the future customer processing contract. /assessments and /jobs use the same paths, job shape and error format as the customer contract; /samples remains supported. Guide for AI coding tools: https://www.craftmyresume.org/business-llms.txt"
  },
  "servers": [
    {
      "url": "https://www.craftmyresume.org/api/business/v1"
    }
  ],
  "security": [
    {
      "businessKey": []
    }
  ],
  "components": {
    "securitySchemes": {
      "businessKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A scoped cmr_b2b_sandbox key issued by the Business workspace. Consumer and live keys are rejected."
      }
    }
  },
  "paths": {
    "/identity": {
      "get": {
        "summary": "Inspect current organization and effective key permissions",
        "description": "Requires jobs:read. Sandbox only. No provider calls or credit charges.",
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Invalid sandbox key"
          },
          "403": {
            "description": "Missing effective permission"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Service unavailable; retry with backoff"
          }
        }
      }
    },
    "/usage": {
      "get": {
        "summary": "Read synthetic run allowance",
        "description": "Requires usage:read. Sandbox only. No provider calls or credit charges.",
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Invalid sandbox key"
          },
          "403": {
            "description": "Missing effective permission"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Service unavailable; retry with backoff"
          }
        }
      }
    },
    "/samples": {
      "get": {
        "summary": "List synthetic run metadata",
        "description": "Requires jobs:read. Sandbox only. No provider calls or credit charges.",
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Invalid sandbox key"
          },
          "403": {
            "description": "Missing effective permission"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Service unavailable; retry with backoff"
          }
        }
      },
      "post": {
        "summary": "Run one fixed synthetic fixture",
        "description": "Requires assess:write. Sandbox only. No provider calls or credit charges.",
        "responses": {
          "201": {
            "description": "Success"
          },
          "401": {
            "description": "Invalid sandbox key"
          },
          "403": {
            "description": "Missing effective permission"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Service unavailable; retry with backoff"
          },
          "409": {
            "description": "Idempotency conflict or ten-run allowance reached"
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{16,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "fixture_id"
                ],
                "properties": {
                  "fixture_id": {
                    "type": "string",
                    "enum": [
                      "backend-evidenced",
                      "backend-sparse"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/samples/{id}/result": {
      "get": {
        "summary": "Read an unexpired synthetic result",
        "description": "Requires results:read. Sandbox only. No provider calls or credit charges.",
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Invalid sandbox key"
          },
          "403": {
            "description": "Missing effective permission"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Service unavailable; retry with backoff"
          },
          "404": {
            "description": "Run not found in this organization"
          },
          "410": {
            "description": "Expired or deleted result"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{8,100}$"
            }
          }
        ]
      }
    },
    "/samples/{id}": {
      "delete": {
        "summary": "Delete a synthetic result without resetting the allowance",
        "description": "Requires content:delete. Sandbox only. No provider calls or credit charges.",
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Invalid sandbox key"
          },
          "403": {
            "description": "Missing effective permission"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Service unavailable; retry with backoff"
          },
          "404": {
            "description": "Run not found in this organization"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{8,100}$"
            }
          }
        ]
      }
    },
    "/assessments": {
      "post": {
        "summary": "Start a synthetic assessment job",
        "description": "Requires assess:write. Sandbox only. No provider calls or credit charges.",
        "responses": {
          "202": {
            "description": "Success"
          },
          "401": {
            "description": "Invalid sandbox key"
          },
          "403": {
            "description": "Missing effective permission"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Service unavailable; retry with backoff"
          },
          "409": {
            "description": "Idempotency conflict or ten-run allowance reached"
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{16,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "fixture_id"
                ],
                "properties": {
                  "fixture_id": {
                    "type": "string",
                    "enum": [
                      "backend-evidenced",
                      "backend-sparse"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}": {
      "get": {
        "summary": "Read job status",
        "description": "Requires jobs:read. Sandbox only. No provider calls or credit charges.",
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Invalid sandbox key"
          },
          "403": {
            "description": "Missing effective permission"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Service unavailable; retry with backoff"
          },
          "404": {
            "description": "Run not found in this organization"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{8,100}$"
            }
          }
        ]
      }
    },
    "/jobs/{id}/cancel": {
      "post": {
        "summary": "Cancel a job; synthetic jobs have already finished, so this returns the job unchanged",
        "description": "Requires assess:write. Sandbox only. No provider calls or credit charges.",
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Invalid sandbox key"
          },
          "403": {
            "description": "Missing effective permission"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Service unavailable; retry with backoff"
          },
          "404": {
            "description": "Run not found in this organization"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{8,100}$"
            }
          }
        ]
      }
    },
    "/jobs/{id}/result": {
      "get": {
        "summary": "Read an unexpired assessment result",
        "description": "Requires results:read. Sandbox only. No provider calls or credit charges.",
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Invalid sandbox key"
          },
          "403": {
            "description": "Missing effective permission"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Service unavailable; retry with backoff"
          },
          "404": {
            "description": "Run not found in this organization"
          },
          "410": {
            "description": "Expired or deleted result"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{8,100}$"
            }
          }
        ]
      }
    },
    "/jobs/{id}/content": {
      "delete": {
        "summary": "Delete a job's result without resetting the allowance",
        "description": "Requires content:delete. Sandbox only. No provider calls or credit charges.",
        "responses": {
          "202": {
            "description": "Success"
          },
          "401": {
            "description": "Invalid sandbox key"
          },
          "403": {
            "description": "Missing effective permission"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Service unavailable; retry with backoff"
          },
          "404": {
            "description": "Run not found in this organization"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{8,100}$"
            }
          }
        ]
      }
    }
  },
  "webhooks": {
    "assessmentCompleted": {
      "post": {
        "summary": "Sent to your callback address when an assessment finishes",
        "description": "Identifiers and status only. Verify X-CMR-Signature against the raw body, answer 2xx within 10 seconds, and deduplicate on event_id. Failed deliveries retry six times over about seven hours.",
        "parameters": [
          {
            "name": "X-CMR-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "t=<unix seconds>,v1=<hex HMAC-SHA256 of t.rawBody>. Holds two v1 values for 24 hours after a secret is replaced."
          },
          {
            "name": "X-CMR-Event-Id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-CMR-Event-Type",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "assessment.completed",
                "webhook.test"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "event_id",
                  "type",
                  "created_at",
                  "data"
                ],
                "properties": {
                  "event_id": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "assessment.completed",
                      "webhook.test"
                    ]
                  },
                  "created_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "job_id": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "succeeded",
                          "failed"
                        ]
                      },
                      "source": {
                        "type": "string",
                        "enum": [
                          "api",
                          "dashboard"
                        ]
                      },
                      "environment": {
                        "type": "string",
                        "enum": [
                          "sandbox",
                          "live"
                        ]
                      },
                      "hiring_job_id": {
                        "type": "string"
                      },
                      "candidate_id": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx marks the event delivered"
          }
        }
      }
    }
  }
}
