{
  "components": {
    "responses": {
      "BadRequest": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Bad Request — missing or invalid parameters."
      },
      "Conflict": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Conflict. Either an identical create is still in flight (matched on your `Idempotency-Key`, or on the request body if you didn't send one), or this attempt held the claim so long that another request took it over — in which case nothing was created and the attempt was rolled back. Retry in both cases: the retry replays the response of whichever attempt completed, or proceeds as a fresh create if the earlier one was abandoned (after 60 seconds)."
      },
      "Forbidden": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Forbidden. Three distinct causes, told apart by `code`: `rest_not_enabled` — the REST API is not switched on for this organization; `write_not_enabled` — it is, but the write surface is not (write endpoints only); `forbidden` — the key is valid but the request came from an IP outside its allowlist. None is fixed by reissuing the key."
      },
      "NotFound": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Not Found — call_id does not exist or is outside the access window."
      },
      "PayloadTooLarge": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Payload Too Large — the call exceeds the maximum accepted size. The transcript dominates this, and the limit applies to the JSON-serialized call, so escape-heavy text (many newlines or quotes) reduces the transcript length that fits."
      },
      "ProjectNotFound": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Not Found — no project with this id in your organization. Deliberately indistinguishable from a project that belongs to another organization."
      },
      "RateLimited": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Too Many Requests — rate limit exceeded.",
        "headers": {
          "X-RateLimit-Limit": {
            "schema": {
              "type": "integer"
            }
          },
          "X-RateLimit-Remaining": {
            "schema": {
              "type": "integer"
            }
          },
          "X-RateLimit-Reset": {
            "schema": {
              "type": "integer"
            }
          }
        }
      },
      "ServiceUnavailable": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Service Unavailable — the write surface is not configured for this deployment."
      },
      "Unauthorized": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Unauthorized — missing or invalid API key."
      },
      "UnprocessableEntity": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Unprocessable Entity — this `Idempotency-Key` was already used with a different request body. Retry with the original body, or use a new key. The stored response is never served to a request that doesn't match it. Only reachable if you send the header: without one, a different body is a different key."
      }
    },
    "schemas": {
      "Call": {
        "properties": {
          "call_id": {
            "type": "string"
          },
          "call_type": {
            "description": "The type of call. `interview` for an expert/research interview, `meeting` for an internal meeting.",
            "enum": [
              "interview",
              "meeting"
            ],
            "type": "string"
          },
          "conducted_by_email": {
            "description": "Email of the user who conducted the call (the transcript creator). Present only when your organization is configured to return participant emails. `null` if that user's profile is unavailable.",
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "duration_seconds": {
            "description": "Call duration in whole seconds, derived from the call recording/transcript. `null` when the duration is unknown.",
            "type": [
              "integer",
              "null"
            ]
          },
          "expert_network_participant_emails": {
            "description": "Participant email addresses associated with the expert-network (EN) call: your own team members on the call plus any other attendees the provider reported. Does NOT include the expert's own email — Junior does not store it. Present only when your organization is configured to return participant emails. Empty array for calls that did not originate from an EN integration.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "interview": {
            "$ref": "#/components/schemas/Interview"
          },
          "project_id": {
            "description": "UUID of the Junior project this call belongs to — the same `project_id` used by `GET /v1/projects/{project_id}`. `null` when the call is not in a project.",
            "type": [
              "string",
              "null"
            ]
          },
          "summary": {
            "description": "Present only when `include_summary=true` (and only if your organization returns summaries).",
            "type": "string"
          },
          "transcripts": {
            "items": {
              "$ref": "#/components/schemas/Transcript"
            },
            "type": "array"
          }
        },
        "required": [
          "call_id",
          "call_type",
          "created_at",
          "duration_seconds",
          "interview",
          "project_id",
          "transcripts"
        ],
        "type": "object"
      },
      "CallRef": {
        "properties": {
          "call_id": {
            "description": "External call identifier (UUID).",
            "type": "string"
          },
          "duration_seconds": {
            "description": "Call duration in whole seconds, derived from the call recording/transcript. `null` when the duration is unknown.",
            "type": [
              "integer",
              "null"
            ]
          },
          "project_id": {
            "description": "UUID of the Junior project this call belongs to — the same `project_id` used by `GET /v1/projects/{project_id}`. `null` when the call is not in a project.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "call_id",
          "duration_seconds",
          "project_id"
        ],
        "type": "object"
      },
      "Error": {
        "properties": {
          "error": {
            "properties": {
              "code": {
                "enum": [
                  "bad_request",
                  "unauthorized",
                  "forbidden",
                  "rest_not_enabled",
                  "write_not_enabled",
                  "write_not_configured",
                  "not_found",
                  "payload_too_large",
                  "idempotency_key_in_progress",
                  "idempotency_key_reused",
                  "rate_limited",
                  "internal_error"
                ],
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message",
              "request_id"
            ],
            "type": "object"
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      },
      "Interview": {
        "properties": {
          "billing_code": {
            "description": "The project's billing/engagement code (labeled \"Project Code\" in the Junior UI by default). Returns `null` unless your organization is configured to return billing codes (and the call's project has one set).",
            "type": [
              "string",
              "null"
            ]
          },
          "billing_office": {
            "description": "Resolved billing-office display name for the call's project. Returns `null` unless your organization is configured to return billing offices (and the project has a billing office assigned).",
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "job_title": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "description": "Speaker name. Returns the anonymized pseudonym unless your organization is configured to return original (non-redacted) transcripts.",
            "type": [
              "string",
              "null"
            ]
          },
          "organization": {
            "type": [
              "string",
              "null"
            ]
          },
          "rating": {
            "type": [
              "integer",
              "null"
            ]
          },
          "sector": {
            "description": "Reserved. Returns `null` in v1.",
            "type": [
              "string",
              "null"
            ]
          },
          "segment": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "Pagination": {
        "properties": {
          "page": {
            "type": "integer"
          },
          "per_page": {
            "type": "integer"
          },
          "total_items": {
            "type": "integer"
          },
          "total_pages": {
            "type": "integer"
          }
        },
        "required": [
          "page",
          "per_page",
          "total_items",
          "total_pages"
        ],
        "type": "object"
      },
      "Project": {
        "properties": {
          "billing_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "billing_office_name": {
            "description": "The resolved billing office name, or null if none.",
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "invited_lead_emails": {
            "description": "Requested lead_emails junior had never seen: pending LEAD project invitations, not memberships. No account is created and no invitation email is sent; the person joins through normal supported sign-in. Invitations expire after one year.",
            "items": {
              "format": "email",
              "type": "string"
            },
            "type": "array"
          },
          "invited_member_emails": {
            "description": "Requested member_emails junior had never seen: pending MEMBER project invitations, not memberships. No account is created and no invitation email is sent; the person joins through normal supported sign-in. Invitations expire after one year.",
            "items": {
              "format": "email",
              "type": "string"
            },
            "type": "array"
          },
          "lead_emails": {
            "description": "The lead users applied as memberships — the subset of requested lead_emails that resolved in the org.",
            "items": {
              "format": "email",
              "type": "string"
            },
            "type": "array"
          },
          "member_emails": {
            "description": "The member users applied as memberships — the subset of requested member_emails that resolved in the org (emails already in another organization are skipped). Never-seen emails land in `invited_member_emails` instead until they first sign in.",
            "items": {
              "format": "email",
              "type": "string"
            },
            "type": "array"
          },
          "name": {
            "type": "string"
          },
          "sector": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "lead_emails",
          "member_emails"
        ],
        "type": "object"
      },
      "ProjectDetail": {
        "description": "A project read back via `GET /v1/projects/{project_id}`. Same fields as the create response, except that some sensitive fields may be omitted depending on your organization's configuration. An API key is an organization credential, so this can return a project nobody using that key created.",
        "properties": {
          "billing_code": {
            "description": "Returns `null` unless your organization is configured to return billing codes.",
            "type": [
              "string",
              "null"
            ]
          },
          "billing_office_name": {
            "description": "The resolved billing office name, or null if none. Returns `null` unless your organization is configured to return billing offices.",
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "invited_lead_emails": {
            "description": "Active pending LEAD project invitations. Present only when participant emails are permitted, sorted alphabetically. API-created invitations create no account and send no invitation email; they expire after one year.",
            "items": {
              "format": "email",
              "type": "string"
            },
            "type": "array"
          },
          "invited_member_emails": {
            "description": "Active pending MEMBER project invitations. Present only when participant emails are permitted, sorted alphabetically. API-created invitations create no account and send no invitation email; they expire after one year.",
            "items": {
              "format": "email",
              "type": "string"
            },
            "type": "array"
          },
          "is_archived": {
            "description": "Whether the project is archived. Set with `POST /v1/projects/{project_id}/archive` and `POST /v1/projects/{project_id}/unarchive`.",
            "type": "boolean"
          },
          "lead_emails": {
            "description": "The lead users applied. Present only when your organization is configured to return participant emails — omitted entirely otherwise, so an absent key is indistinguishable from an empty list. Sorted alphabetically: the create echoes emails in request order, which isn't recoverable on a re-read. Pending lead invitations are listed separately in `invited_lead_emails`.",
            "items": {
              "format": "email",
              "type": "string"
            },
            "type": "array"
          },
          "member_emails": {
            "description": "The member users applied. Same participant-email gate and ordering as `lead_emails`.",
            "items": {
              "format": "email",
              "type": "string"
            },
            "type": "array"
          },
          "name": {
            "type": "string"
          },
          "sector": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "is_archived"
        ],
        "type": "object"
      },
      "ProjectRef": {
        "description": "Lean project summary returned by the list endpoint — enough to identify a project and pick one. Fetch `GET /v1/projects/{project_id}` for the full record (billing office, member emails).",
        "properties": {
          "billing_code": {
            "description": "Returns `null` unless your organization is configured to return billing codes. Gated identically to the detail endpoint.",
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "description": "Project UUID. Pass as `project_id` elsewhere.",
            "format": "uuid",
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "sector": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "sector",
          "billing_code",
          "created_at"
        ],
        "type": "object"
      },
      "Transcript": {
        "properties": {
          "cleaned": {
            "description": "`true` for the cleaned entry — the original-language, unredacted transcript restructured as question/answer pairs with lightly rewritten answers.",
            "type": "boolean"
          },
          "is_primary": {
            "description": "Exactly one entry has `is_primary: true` — the original-language, unredacted version of the call.",
            "type": "boolean"
          },
          "language": {
            "description": "Detected language of this transcript entry as a short language code (e.g. `en`, `fr`), or `null` when detection did not run.",
            "type": [
              "string",
              "null"
            ]
          },
          "redacted": {
            "type": "boolean"
          },
          "text": {
            "type": "string"
          }
        },
        "required": [
          "text",
          "language",
          "redacted",
          "cleaned",
          "is_primary"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "description": "API key issued by Junior, sent as `Authorization: Bearer jr_live_…`. Keys are shown once at issuance — store securely.",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "API for the Junior platform: retrieve call transcripts and metadata, and create projects. All endpoints require an API key issued by the Junior team. Write endpoints additionally require the organization to be enabled for the write surface.",
    "title": "Junior API",
    "version": "1.11.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/billing-offices": {
      "get": {
        "description": "Lists your organization's billing offices — the valid values to pass as `billing_office_name` when creating a project. Returns names only (plus which is the default), never internal IDs.",
        "operationId": "listBillingOffices",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "items": {
                        "properties": {
                          "is_default": {
                            "type": "boolean"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "name",
                          "is_default"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "The organization's billing offices."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "summary": "List billing offices",
        "tags": [
          "Projects"
        ]
      }
    },
    "/calls": {
      "get": {
        "description": "Returns a paginated list of calls (ID and duration) within a date range. Calls are ordered by `created_at` DESC with `id` as a stable tiebreaker. Which call types are returned is set per organization; by default only interviews (expert calls) are returned.",
        "operationId": "listCalls",
        "parameters": [
          {
            "description": "Inclusive lower bound (RFC 3339 date-time). UTC (`...Z`) or a numeric offset (`...-05:00`) are both accepted.",
            "in": "query",
            "name": "start_date",
            "required": true,
            "schema": {
              "example": "2024-01-01T00:00:00Z",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Inclusive upper bound (RFC 3339 date-time). UTC (`...Z`) or a numeric offset (`...-05:00`) are both accepted.",
            "in": "query",
            "name": "end_date",
            "required": true,
            "schema": {
              "example": "2024-12-31T23:59:59Z",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Filter to calls in this project (UUID from `GET /v1/projects`). A project outside your organization returns no calls.",
            "in": "query",
            "name": "project_id",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Filter to calls created by the user with this email.",
            "in": "query",
            "name": "user_email",
            "schema": {
              "format": "email",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "per_page",
            "schema": {
              "default": 25,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "items": {
                        "$ref": "#/components/schemas/CallRef"
                      },
                      "type": "array"
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Paginated list of call IDs."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "summary": "List calls",
        "tags": [
          "Calls"
        ]
      },
      "post": {
        "description": "Ingests a call from a source Junior has no direct integration with. Creation only — this never modifies an existing call. Returns 202: the call is created asynchronously and appears in `GET /v1/calls` once processing starts, so poll rather than expecting it in the response. Requires the organization to be enabled for the write surface.",
        "operationId": "ingestCall",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "attendee_emails": {
                    "description": "People to invite to the call; they can then see it even when it has no project. Emails that don't resolve to users in your organization are skipped rather than rejected. You must supply this OR `project_id`: a call with neither has no project, no creator (API keys authenticate as an organization, not a user) and no invitees, so it appears in no call list at all — not even Unmatched — and the request is rejected with 400.",
                    "items": {
                      "format": "email",
                      "type": "string"
                    },
                    "maxItems": 100,
                    "type": "array"
                  },
                  "date": {
                    "description": "When the call took place (RFC 3339). Either UTC (`2026-01-02T10:00:00Z`) or a numeric offset (`2026-01-02T10:00:00-05:00`) — both resolve to the same instant. A local time with no offset is rejected as ambiguous.",
                    "example": "2026-01-02T10:00:00Z",
                    "format": "date-time",
                    "type": "string"
                  },
                  "expert_organization": {
                    "description": "The expert's employer — NOT your organization.",
                    "maxLength": 255,
                    "type": "string"
                  },
                  "external_id": {
                    "description": "Your own stable identifier for this call, and the deduplication key: re-sending the same `external_id` is a no-op rather than a second call. STRONGLY RECOMMENDED. When omitted, a fingerprint is derived from the call's content and identity fields instead — which means a corrected re-send is treated as a new call.",
                    "maxLength": 255,
                    "minLength": 1,
                    "type": "string"
                  },
                  "job_title": {
                    "maxLength": 255,
                    "type": "string"
                  },
                  "name": {
                    "description": "The expert's name.",
                    "maxLength": 255,
                    "minLength": 1,
                    "type": "string"
                  },
                  "project_id": {
                    "description": "Project to file the call under; every member of that project can then see the call. Rejected with 400 if the project isn't in your organization. REQUIRED unless you supply `attendee_emails` — see the note on that field.",
                    "format": "uuid",
                    "type": "string"
                  },
                  "source": {
                    "description": "Where the call came from, e.g. the expert network's name. Recorded as the call's source.",
                    "maxLength": 255,
                    "type": "string"
                  },
                  "transcript": {
                    "description": "The transcript text. Plain text or markdown — not a file upload.",
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "transcript"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "external_id": {
                          "description": "The deduplication key used — the one you supplied, or the derived fingerprint if you omitted it. Reuse it to make a retry idempotent.",
                          "type": "string"
                        },
                        "project_id": {
                          "description": "Echoes the project the call was filed under, or `null` when it was left unmatched.",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "status": {
                          "enum": [
                            "processing"
                          ],
                          "type": "string"
                        }
                      },
                      "required": [
                        "external_id",
                        "status"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Accepted — the call is queued for creation and processing."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "summary": "Ingest a call",
        "tags": [
          "Calls"
        ]
      }
    },
    "/calls/{call_id}": {
      "get": {
        "description": "Returns interview metadata, optional summary, and one or more transcript entries. Which entries appear depends on the request flags and your organization's configuration.",
        "operationId": "getCall",
        "parameters": [
          {
            "in": "path",
            "name": "call_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Include the primary, non-redacted transcript entry. This is original-language content, so it is returned only when your organization is permitted both the `original_transcript` and `original_language` fields. Otherwise the entry is omitted with no error.",
            "in": "query",
            "name": "include_transcript",
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "description": "Include the redacted transcript entry. Enabled by default. Returned only when your organization is permitted the `redacted_transcript` field and the call is fully anonymized. Otherwise the entry is omitted with no error.",
            "in": "query",
            "name": "include_redacted_transcript",
            "schema": {
              "default": true,
              "type": "boolean"
            }
          },
          {
            "description": "Include the cleaned transcript entry — question/answer pairs with lightly rewritten answers. This is original-language, non-redacted content, so it is returned only when your organization is permitted the `cleaned_transcript` field and cleaned Q&A data exists for the call. Otherwise the entry is omitted with no error. Because the redacted entry is on by default, a cleaned request from an organization that lacks this field returns only the redacted entry — but only when that entry is itself permitted and available. Otherwise the response contains no transcript entries.",
            "in": "query",
            "name": "include_cleaned_transcript",
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "description": "Include `data.summary` in the response.",
            "in": "query",
            "name": "include_summary",
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "description": "Reserved for v2 (translation support); accepted but ignored in v1, where every transcript entry is already original-language.",
            "in": "query",
            "name": "include_original_language",
            "schema": {
              "default": false,
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Call"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Call detail."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "summary": "Get a single call",
        "tags": [
          "Calls"
        ]
      }
    },
    "/projects": {
      "get": {
        "description": "Lists your organization's projects, newest first. Use it to find a `project_id` — for example the one to pass to `POST /v1/calls`. Returns a lean summary per project; fetch `GET /v1/projects/{project_id}` for the full record. Requires the organization to be enabled for the write surface.\n\nScoped to the ORGANIZATION, not to a user: an API key authenticates an organization rather than a person, so every project in the organization is listed.",
        "operationId": "listProjects",
        "parameters": [
          {
            "description": "Filter to projects with this exact name (case-insensitive). Not a substring or pattern match.",
            "in": "query",
            "name": "name",
            "required": false,
            "schema": {
              "maxLength": 255,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "default": 1,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "per_page",
            "required": false,
            "schema": {
              "default": 25,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "items": {
                        "$ref": "#/components/schemas/ProjectRef"
                      },
                      "type": "array"
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Paginated list of projects."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "summary": "List projects",
        "tags": [
          "Projects"
        ]
      },
      "post": {
        "description": "Creates a project for the authenticated key's organization. Requires the organization to be enabled for the write surface.\n\n**Retries are safe by default.** Send the same body twice within 24 hours and the second request replays the first one's 201 instead of creating a second project — no header needed. This matters because there is no way to delete a project through this API, so a duplicate needs manual cleanup on our side.\n\nSend an `Idempotency-Key` header when you want to control that yourself: two different keys mean two deliberate creates, even with identical bodies.\n\n**Emails that junior has never seen are fine.** They don't need an account yet: the request stages a pending project invitation with the listed role, reported in `invited_lead_emails` / `invited_member_emails`. No account is created and no invitation email is sent; they join through normal supported sign-in. Invitations expire after one year. The first listed lead is the designated creator. If that person is pending, the creator remains unset until their lead membership is granted; other leads signing in first do not become the creator. API invitations do not override existing SSO, valid web-invitation, or registered email-domain organization mappings; conflicting API invitations cannot arbitrarily choose an organization. An email that already belongs to a different organization is skipped for members and rejected for leads.",
        "operationId": "createProject",
        "parameters": [
          {
            "description": "Optional. Deduplication is on whether or not you send this — omit it and the key is derived from the request body — so the header is an override, not the thing that switches protection on.\n\nAn opaque, caller-generated value (max 255 printable ASCII characters, no whitespace; must not begin with `auto:`, which is reserved for derived keys). Retrying with the same key and the same body returns the ORIGINAL 201 and its response body. Reusing a key with a different body is rejected with 422; retrying while the first attempt is still in flight returns 409. Keys are scoped to your organization and this endpoint.\n\n**Reach for it in two cases.** To create two projects with identical bodies on purpose: give them different keys, since without a key identical bodies are treated as one create. Or to keep a create replay-safe for longer than 24 hours: a key you supply keeps replaying for at least 7 days, while a derived one stops replaying after 24 hours so that a genuinely later identical create still works.\n\n**Equality is semantic, not byte-for-byte:** the stored response is held as JSON, so a replay is the same JSON document — object-key order and whitespace are not guaranteed to match the original bytes.",
            "example": "00000000-0000-4000-8000-000000000001",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "maxLength": 255,
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "billing_code": {
                    "description": "Client-facing engagement/charge code (the “Project Code”). Optional.",
                    "type": "string"
                  },
                  "billing_office_name": {
                    "description": "Billing office by name (case-insensitive; must exist in your organization). Resolved server-side to the office and its billing policy — you never supply the internal ID. Rejected with 400 if the name doesn't match an office.",
                    "type": "string"
                  },
                  "budget": {
                    "minimum": 0,
                    "type": "number"
                  },
                  "lead_emails": {
                    "description": "Project leads (at least one), each added with the `lead` role when already in the organization. The first email is the designated project and running-summary creator. If that person is unknown, their pending invitation retains the designation and fills the creator fields when lead membership is granted. Other leads never take their place; removing the pending invitation cancels the designation. No account is created and no invitation email is sent. If an email also appears in member_emails, lead wins.",
                    "items": {
                      "format": "email",
                      "type": "string"
                    },
                    "maxItems": 20,
                    "minItems": 1,
                    "type": "array"
                  },
                  "member_emails": {
                    "description": "Additional members added with the `member` role. An email junior has never seen receives a pending project invitation, with no account created and no invitation email sent. An email already in another organization is skipped. Leads are never double-added and win if named in both lists.",
                    "items": {
                      "format": "email",
                      "type": "string"
                    },
                    "maxItems": 100,
                    "type": "array"
                  },
                  "name": {
                    "maxLength": 255,
                    "minLength": 1,
                    "type": "string"
                  },
                  "sector": {
                    "type": "string"
                  },
                  "timezone": {
                    "description": "Optional. Not stored — a US IANA timezone (e.g. `America/New_York`) sets the project locale to en_us; omitted leaves the default locale.",
                    "example": "America/New_York",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "lead_emails"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Project"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Project created."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "summary": "Create a project",
        "tags": [
          "Projects"
        ]
      }
    },
    "/projects/{project_id}": {
      "get": {
        "description": "Returns a project your organization owns — use it to confirm the server-resolved values (`billing_office_name`, applied memberships, and durable pending invitations) or to re-read a project whose create response you lost.\n\nScope: your API key identifies an *organization*, not a user, so this returns any project in your organization — including ones created in the Junior web app. Some sensitive fields (billing code, billing office, membership emails, and pending invitation emails) may be omitted depending on your organization's configuration, exactly as on the call endpoints.\n\nThis endpoint needs an id, so it can't recover a create that never returned one. For that, re-send the create: within 24 hours it replays the original 201 rather than making a second project. Requires the organization to be enabled for the write surface.",
        "operationId": "getProject",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ProjectDetail"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Project detail. Field availability depends on your organization's configuration — see the schema."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/ProjectNotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "summary": "Get a project",
        "tags": [
          "Projects"
        ]
      },
      "patch": {
        "description": "Edits a project your organization owns after it was created — rename it, change its billing fields or budget, add leads and members, or remove leads and members. Requires the organization to be enabled for the write surface.\n\n**Every field is optional; send only what you want to change.** `name` renames the project and can't be cleared. For `billing_code`, `billing_office_name`, and `budget`: a value sets it, `null` clears it, and omitting it leaves it untouched.\n\n**`lead_emails` and `member_emails` are add-only.** Listed users are added with that role; anyone already on the project (in any role) is skipped, so re-sending is safe and never changes a role. An email junior has never seen receives a pending project invitation with the listed role; no account is created and no invitation email is sent. Re-adding a pending lead never downgrades it; adding a pending member as a lead promotes it. An explicit API assignment adopts any existing pending web invitation for that email and project into automatic acceptance on first web sign-in, preserving its token. Web invitations not assigned through the API still require explicit acceptance.\n\n**`remove_member_emails` removes people in any role, leads included.** There is no separate `remove_lead_emails` field: to remove a lead, list their email in `remove_member_emails`. It also cancels matching pending invitations, lead or member. Removing the project creator hands creator ownership to the most recently added remaining lead, so a single call with the new lead in `lead_emails` and the old one in `remove_member_emails` transfers the project. If no other lead with an account remains, removing the creator is rejected with 400. An email can't appear in both an add list and `remove_member_emails`, and can't be in both `lead_emails` and `member_emails` — either is rejected with 400.\n\nThe response echoes the project's durable state after the edit, gated per field exactly like `GET /v1/projects/{project_id}`.",
        "operationId": "updateProject",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "minProperties": 1,
                "properties": {
                  "billing_code": {
                    "description": "Client-facing engagement/charge code. Send a value to set it, `null` to clear it, or omit to leave it unchanged.",
                    "maxLength": 255,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "billing_office_name": {
                    "description": "Billing office by name (case-insensitive; must exist in your organization). Resolved server-side to the office and its billing policy. Send a value to set it, `null` to clear it, or omit to leave it unchanged. Rejected with 400 if a non-null name doesn't match an office.",
                    "maxLength": 255,
                    "minLength": 1,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "budget": {
                    "description": "Send a value to set it, `null` to clear it, or omit to leave it unchanged.",
                    "minimum": 0,
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "lead_emails": {
                    "description": "Users to ADD with the `lead` role. A never-seen email receives a pending LEAD project invitation; no account is created and no invitation email is sent. Adding a pending member as a lead promotes it, while a pending lead is never downgraded. Anyone already on the project is skipped.",
                    "items": {
                      "format": "email",
                      "type": "string"
                    },
                    "maxItems": 20,
                    "type": "array"
                  },
                  "member_emails": {
                    "description": "Users to ADD with the `member` role. An email junior has never seen receives a pending project invite (no account created — the person joins as a member on first sign-in). Anyone already on the project is skipped.",
                    "items": {
                      "format": "email",
                      "type": "string"
                    },
                    "maxItems": 100,
                    "type": "array"
                  },
                  "name": {
                    "description": "New project name. Leading and trailing whitespace is trimmed. Can't be cleared: `null` or a blank name is rejected with 400.",
                    "maxLength": 255,
                    "minLength": 1,
                    "type": "string"
                  },
                  "remove_member_emails": {
                    "description": "Emails to REMOVE from the project, in any role: use this field for leads as well as members (there is no `remove_lead_emails`). Matching pending invitations are cancelled too, including for people who have never signed in. Removing the project creator hands creator ownership to the most recently added remaining lead; it is rejected with 400 when no other lead with an account remains. Unknown emails are ignored.",
                    "items": {
                      "format": "email",
                      "type": "string"
                    },
                    "maxItems": 100,
                    "type": "array"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ProjectDetail"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Project updated. Field availability depends on your organization's configuration — see the schema."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/ProjectNotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "summary": "Update a project",
        "tags": [
          "Projects"
        ]
      }
    },
    "/projects/{project_id}/archive": {
      "post": {
        "description": "Archives a project your organization owns. Idempotent: archiving an already-archived project returns 200 and changes nothing. Requires the organization to be enabled for the write surface.\n\nThe response echoes the project's state after the archive, gated per field exactly like `GET /v1/projects/{project_id}`.",
        "operationId": "archiveProject",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ProjectDetail"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Project archived. Field availability depends on your organization's configuration — see the schema."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/ProjectNotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "summary": "Archive a project",
        "tags": [
          "Projects"
        ]
      }
    },
    "/projects/{project_id}/unarchive": {
      "post": {
        "description": "Unarchives a project your organization owns. Idempotent: unarchiving a project that is not archived returns 200 and changes nothing. Requires the organization to be enabled for the write surface.\n\nThe response echoes the project's state after the unarchive, gated per field exactly like `GET /v1/projects/{project_id}`.",
        "operationId": "unarchiveProject",
        "parameters": [
          {
            "in": "path",
            "name": "project_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ProjectDetail"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Project unarchived. Field availability depends on your organization's configuration — see the schema."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/ProjectNotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "summary": "Unarchive a project",
        "tags": [
          "Projects"
        ]
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "servers": [
    {
      "url": "https://api.junior.ai/v1"
    }
  ],
  "tags": [
    {
      "description": "Read call (interview) records, metadata, and transcripts, and ingest calls from sources Junior has no direct integration with. List first, then fetch a single call by `call_id` for the full record. Ingestion requires the organization to be enabled for the write surface.",
      "name": "Calls"
    },
    {
      "description": "Create, edit, archive, and unarchive projects, and look up the billing offices a project can be assigned to. Requires the organization to be enabled for the write surface.",
      "name": "Projects"
    }
  ]
}