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

> ## Agent Instructions
> Use Stable documentation by default. Honor an explicit Beta request or a URL under /docs/beta/. If the requested version conflicts with the installed CLI package or API origin, clarify the target before writing integration code.
> Pages under /docs/beta/ document Beta; other product pages document Stable. Keep the CLI package, commands, API origin, and credentials within the selected version. State the documentation version in your answer.
> For MCP search, always pass version: Stable or version: Beta. Unfiltered search mixes both versions. For filesystem reads, keep Beta queries under /beta/ and exclude /beta/ from Stable queries; discover paths before reading them.
> The public docs base is https://photon.codes/docs. Convert MCP page paths to public URLs under that base, preserving /beta/ when present. Read https://photon.codes/docs/skill.md for version selection and https://photon.codes/docs/llms.txt for the version indexes.

# ADS-0005: Standard Resource Methods and Lifecycle

> Standard HTTP methods, read symmetry for addressable resources, canonical success status codes, representation consistency, URL path naming, and RFC 7396 JSON Merge Patch semantics across Photon public HTTP APIs.

* **Status**: Approved
* **Updated**: 2026-11-28

Consistent HTTP methods, read symmetry, status codes, and URL structure let callers, generated SDKs, dashboards, CLIs, and automated agents navigate every Photon resource lifecycle without endpoint-specific special cases. This standard is part of Photon API Design Standards and uses the keywords **MUST**, **MUST NOT**, **SHOULD**, and **MAY** as described in RFC 2119.

## Scope

This standard defines the lifecycle contract for resource collections, addressable items, singletons, and custom state-transition actions across Photon public HTTP APIs:

* Standard HTTP method semantics and prohibited anti-patterns.
* Read symmetry for mutable resources, custom actions, and addressable collections.
* Canonical `2xx` success status codes and representation consistency.
* URL path segment casing and noun conventions.
* Partial-update (`PATCH`) wire semantics using JSON Merge Patch (RFC 7396).

Related concerns are governed by separate standards:

* Resource identifier fields (`id`, `<resource>Id`) and URL path parameter naming (`{<resource>Id}`) are defined in `ADS-0001`.
* Flat top-level JSON response objects and one-time creation secrets are defined in `ADS-0002`.
* Asynchronous long-running operations (`202 Accepted`, `Operation` schema, polling, and cancellation) are defined in `ADS-0004`.
* Pagination, filtering, and sorting query parameters and write-operation idempotency semantics (`Idempotency-Key` on mutating methods) are outside the scope of this standard.

## Normative Rules

### 1. Standard HTTP method semantics

Photon public HTTP APIs **MUST** map standard resource lifecycle operations to standard HTTP methods:

| Operation | Route shape | HTTP method | Semantics |
| - | - | - | - |
| List collection | `/v1/.../<collection>` | `GET` | Read a collection envelope of resources |
| Create resource | `/v1/.../<collection>` | `POST` | Create a new resource in the collection |
| Get item | `/v1/.../<collection>/{<resource>Id}` | `GET` | Read a single addressable resource |
| Partial update | `/v1/.../<collection>/{<resource>Id}` or `/v1/.../<singleton>` | `PATCH` | Merge-update mutable fields on an existing resource |
| Full replace / upsert | `/v1/.../<collection>/{<resource>Id}` or `/v1/.../<singleton>` | `PUT` | Replace a resource in full or perform an idempotent upsert |
| Delete resource | `/v1/.../<collection>/{<resource>Id}` or `/v1/.../<singleton>` | `DELETE` | Remove or soft-delete a single resource |
| Custom action | `/v1/.../<collection>/{<resource>Id}/<action>` | `POST` | Trigger a domain state transition that does not fit CRUD (for example `revoke`, `cancel`, `rotate`, `retry`, `archive`, `restore`) |

* Static URL path segments **MUST NOT** embed CRUD verbs (`create`, `get`, `list`, `update`, `delete`, `remove`, `fetch`, `edit`, or `add`) either as standalone segments (such as `/v1/projects/create`) or as prefixes (such as `/v1/projects/get-project`, `/v1/getUser`, `/v1/list-projects`, or `/v1/api-keys/delete-key`). Legitimate state-mutating domain actions such as `revoke`, `cancel`, `rotate`, `retry`, `resend`, `archive`, `restore`, `verify`, `enable`, `disable`, `transfer-ownership`, and `batch` remain allowed on `POST`, while read-only endpoints such as `preview`, `search`, and `query` **MAY** use `GET` or `POST`.
* A single endpoint path **MUST NOT** declare both `PUT` and `PATCH`. Choose `PATCH` for partial updates or `PUT` for full replacement and idempotent upsert—never both on the same path.
* `GET` operations **MUST NOT** declare a request body (`requestBody`). Complex queries that exceed query-string limits **SHOULD** use a dedicated `POST` search or query endpoint.
* Collection-level `DELETE` operations (paths not ending in a resource identifier parameter `{<resource>Id}`) **MUST NOT** declare a request body. Single-resource deletes identify the target in the URL path, singleton deletes require no body, and bulk deletions **SHOULD** use a dedicated `POST` batch endpoint.

#### Safe and side-effect-free `GET` and `HEAD` semantics

* `GET` (and `HEAD`) operations **MUST** be safe and idempotent per [RFC 9110 Section 9.2.1](https://www.rfc-editor.org/rfc/rfc9110#section-9.2.1): they **MUST NOT** create, modify, or delete resources, overwrite or invalidate in-flight operations or authorization attempts, mint, rotate, or revoke credentials, or trigger external side effects. Only passive observability (such as access logging, metrics, or cache warming) is permitted, except under the narrow protocol-mandated browser callback exception below.
* External callers depend on this guarantee: browser prefetching, enterprise URL security scanners, link previews, double-clicks, SDK automatic retries, and automated agents treat `GET` as read-only and safe to replay without confirmation. If a `GET` handler mutates state or overwrites an active authorization attempt, a single background scan or retried click silently breaks the caller's live workflow.
* `GET` (and `HEAD`) operations **MUST NOT** declare an `Idempotency-Key` header parameter (existing parameters marked `deprecated: true` are permitted only during migration). Requiring an idempotency key signals a state-changing request that belongs on `POST`, `PUT`, `PATCH`, or `DELETE`.
* `GET` (and `HEAD`) operations **MUST NOT** expose unmistakable state-mutating action verbs (such as `/revoke`, `/cancel`, `/rotate`, `/retry`, `/resend`, `/archive`, `/restore`, `/enable`, `/disable`, `/transfer-ownership`, `/pay`, `/purchase`, `/approve`, `/reject`, `/confirm`, `/submit`, `/trigger`, `/publish`, `/unpublish`, `/suspend`, `/unsuspend`, `/activate`, `/deactivate`, `/refund`, `/void`, `/reset`, `/purge`, `/invalidate`, `/disconnect`, `/unlink`, `/install`, `/uninstall`, `/deploy`, `/rollback`, `/pause`, `/resume`, or `/verify`) as their terminal path segment. State-changing actions belong on `POST`.
* Read-only helper and outbound relay routes (such as `/redirect`, `/download`, `/export`, `/preview`, `/search`, `/query`, `/count`, `/status`, `/pdf`, or `/receipt`) remain allowed on `GET`, provided their handler obeys the safe, side-effect-free requirement above.

#### Protocol-mandated browser callbacks (`GET .../callback`)

External browser-redirect protocols—such as [OAuth 2.0 Authorization Code Grant (RFC 6749 Section 4.1.2)](https://www.rfc-editor.org/rfc/rfc6749#section-4.1.2), OpenID Connect, SSO, and third-party integration install flows—require the external provider to return the user's browser via an HTTP `GET` redirect carrying authorization parameters. Because the provider dictates the HTTP method, an inbound browser callback endpoint (including a `302` callback hop chained directly from that provider return before continuing the provider's browser flow) **MAY** complete that single bound authorization or installation handoff (such as exchanging an authorization code, establishing a browser session, or binding the authorized installation) **only** when **all** of the following invariants hold:

1. **Protocol-mandated browser flow**: The route exists solely to receive an external browser redirect that cannot deliver `POST`. Outbound handoffs initiated by a caller (such as `GET .../redirect`) and general API operations **MUST NOT** use this exception.
2. **Short-lived, single-use, initiator-bound correlation**: Before performing any state transition, the handler **MUST** verify a short-lived, single-use, unpredictable opaque correlation token (generated with a cryptographically secure random generator, such as an OAuth `state` or authorization `attempt` token) bound to the initiating user's authenticated session or PKCE/CSRF cookie (see [RFC 6749 Sections 10.10](https://www.rfc-editor.org/rfc/rfc6749#section-10.10) and [10.12](https://www.rfc-editor.org/rfc/rfc6749#section-10.12)), so unauthenticated link scanners, prefetches, or other principals cannot guess, trigger, or hijack it.
3. **Convergent replay and concurrency handling**: Replaying or concurrently delivering the same callback (such as from a double-click or browser reload) **MUST NOT** create, rotate, or overwrite any in-flight attempt or resource; the handler **MUST** converge to the already-settled redirect outcome or cleanly reject the spent token.
4. **Redirect-only, non-cacheable response**: The endpoint **MUST** respond only with an HTTP redirect (such as `302 Found`) carrying `Cache-Control: no-store` (and **SHOULD** set `Referrer-Policy: no-referrer`), and **MUST NOT** act as a JSON API endpoint returning `200` data payloads.
5. **Callback route naming**: The route path **MUST** use `/callback` (or `/callback/<provider>` / `/callback/{provider}` when segmented by external provider) rather than a state-mutating action verb such as `/resume` or `/complete`.

### 2. Read symmetry for addressable resources

Every addressable resource that can be listed, modified, deleted, or transitioned through a custom action **MUST** be directly readable via `GET`.

#### Mutation-to-read symmetry

* On any addressable item path ending in `{<resource>Id}`, if the path declares `PATCH`, `PUT`, or `DELETE`, or exposes a custom action sub-route `POST .../{<resource>Id}/<action>`, the API **MUST** also expose a single-resource `GET`—either directly on the same item path (`GET .../{<resource>Id}`) or on a hoisted canonical item path (after removing one or more leading `/<scope>/{<scopeId>}` prefixes) with a compatible resource representation.
* On any singleton resource path (not ending in `{<resource>Id}`), if the path declares `PATCH`, `PUT`, or `DELETE` (excluding collection `DELETE` endpoints with a request body), the exact same path **MUST** also declare `GET`.

#### Collection-to-item read symmetry

* Whenever a collection `GET` endpoint returns a collection envelope whose array items declare a canonical `ADS-0001` primary identifier field (`id`), the API **MUST** expose a corresponding single-resource `GET` endpoint:
  1. **Direct child route**: `GET <collectionPath>/{<resource>Id}` (for example `GET /v1/projects/{projectId}/webhooks` paired with `GET /v1/projects/{projectId}/webhooks/{webhookId}`), **OR**
  2. **Hoisted canonical route**: `GET /v1/<resource>/{<resource>Id}` (or a less-nested canonical path obtained by removing one or more leading `/<scope>/{<scopeId>}` pairs after the version prefix, for example `GET /v1/organizations/{organizationId}/projects` paired with `GET /v1/projects/{projectId}`), provided the list item schema and hoisted `GET` response schema are compatible (either referencing the same schema or forming a compatible summary projection whose required properties and `id` type match the canonical item schema).
* Non-resource lookup collections whose items do not carry a primary `id` (such as supported countries, permission scopes, or recommendations) and multi-field composite summaries are outside this requirement.
* Rare append-only streams or audit logs whose items carry an `id` but intentionally have no single-item `GET` endpoint **SHOULD** document the reason explicitly.

### 3. Standard success status codes

Standard resource methods **MUST** use predictable `2xx` HTTP status codes:

| Method / Operation | Canonical success status | Notes |
| - | - | - |
| `GET` | `200 OK` | **MUST NOT** declare `201` or `202`. **MAY** also support `304 Not Modified` for conditional reads. |
| Collection `POST` (create) | `201 Created` or `202 Accepted` | Synchronous creation **MUST** declare `201`. Asynchronous creation **MUST** declare `202` per `ADS-0004`. `200` **MAY** appear alongside `201` or `202` for idempotent replay, but collection creation **MUST NOT** declare only `200` or `204`. |
| Custom action `POST` | `200 OK`, `202 Accepted`, or `204 No Content` | Synchronous state transitions **SHOULD** return `200` with the updated resource or receipt; asynchronous actions return `202` per `ADS-0004`. |
| `PATCH` | `200 OK` or `202 Accepted` | **MUST NOT** declare `204 No Content`. A `200` response **MUST** declare a response body (`content`) returning the updated resource so callers do not need a follow-up `GET`. |
| `PUT` | `200 OK`, `201 Created`, or `202 Accepted` | Return `200` for replacement (or `201` when creating on upsert) with the updated resource representation. |
| `DELETE` | `204 No Content`, `200 OK`, or `202 Accepted` | Synchronous deletion **SHOULD** return `204` with no response body (`content`). **MAY** return `200` with a JSON resource or receipt body for explicit soft-deletion, or `202` for asynchronous deletion. **MUST NOT** declare `201` and **MUST NOT** attach a response body to `204`. |

### 4. Representation consistency

* `GET`, `POST` (`201 Created`), `PATCH` (`200 OK`), and `PUT` (`200 OK` or `201 Created`) for the same resource **SHOULD** return the same canonical flat JSON representation per `ADS-0002`.
* Items returned by a collection `GET` **SHOULD** use the same canonical resource schema or a strict summary projection that preserves `id` and shared field names and types so callers can fetch full details from the corresponding item `GET` without renaming fields.
* Only one-time creation secrets (such as `secret` or `signingSecret`, returned as flat sibling fields per `ADS-0002`) **MAY** be returned exclusively on `POST` `201 Created` and omitted from subsequent `GET` and `PATCH` responses.
* Synchronous `201 Created` responses **SHOULD** include a `Location` response header pointing to the newly created resource's canonical `GET` URL (for example `Location: https://api.photon.codes/v1/projects/prj_01h455vb4pex5vsknk084sn02q/webhooks/whk_01h455vb4pex5vsknk084sn02z`).

### 5. URL path naming

* Every static URL path segment (excluding `{param}` placeholders, leading version prefixes such as `v1`, and `.well-known`) **MUST** use lowercase `kebab-case` (for example `/v1/projects/{projectId}/api-keys` and `/v1/projects/{projectId}/agent-profile`).
* Static segments **MUST NOT** use `camelCase` (`/apiKeys`), `snake_case` (`/api_keys`), uppercase letters (`/Projects`), dots, or spaces.
* Collection path segments **SHOULD** use plural nouns (for example `projects`, `webhooks`, `api-keys`, `members`, `invoices`), and singleton sub-resource path segments **SHOULD** use singular nouns (for example `agent-profile`).

### 6. Partial updates (`PATCH`)

Every `PATCH` endpoint **MUST** use a JSON object merge-patch contract based on **JSON Merge Patch ([RFC 7396](https://www.rfc-editor.org/rfc/rfc7396))** over `Content-Type: application/json`, with two explicit Photon profile rules for typed nullable fields and dynamic key-value maps:

* **Media type and payload shape**: `PATCH` requests **MUST** accept a JSON object over `application/json` (or a compatible JSON media type). Top-level arrays, scalars, and `null` are forbidden. Endpoints **MUST NOT** use JSON Patch ([RFC 6902](https://www.rfc-editor.org/rfc/rfc6902), `application/json-patch+json`, or a top-level patch-operation array) and **MUST NOT** accept or require field-mask query parameters or body fields (`fieldMask`, `updateMask`, `field_mask`, `update_mask`, `fieldsMask`, `fields_mask`).
* **Three-state field semantics**:
  * **Omitted field**: Leave the current stored value unchanged.
  * **Explicit `null`** *(Photon typed-schema rule)*: Whereas raw RFC 7396 §2 removes an object member on `null`, Photon's typed resource schemas represent cleared nullable fields explicitly as `null` (`type: ["<T>", "null"]`). Sending `null` **MUST** clear a nullable field to `null`. Explicit `null` is valid **only** on fields whose canonical representation allows `null`; sending `null` for a non-nullable field **MUST** be rejected with `422 Unprocessable Content` (RFC 9457 Problem Details, `VALIDATION_FAILED`).
  * **Non-null value**: Set or replace the field with the supplied value.
* **Nested objects, arrays, and maps**:
  * Plain nested objects (fixed-schema sub-objects such as `notifications` or `settings`) **MUST** merge recursively under the same three-state rules per RFC 7396, so omitting a sibling nested field leaves that sibling unchanged.
  * Arrays **MUST** replace wholesale per RFC 7396—supplying an array replaces the entire stored list rather than appending or element-diffing.
  * **Dynamic key-value maps** *(Photon profile deviation from raw RFC 7396 §2)*: Unlike raw RFC 7396 (which recursively merges all JSON objects and requires per-key `null` tombstones to remove entries), arbitrary key-value maps (`additionalProperties` dictionaries such as `labels` or `metadata`) **MUST** replace wholesale unless an endpoint explicitly documents per-key RFC 7396 `null`-deletion merge semantics.
* **Atomicity**: Every `PATCH` request **MUST** execute atomically (all-or-nothing). If any field fails schema validation, authorization, or a domain invariant, the server **MUST** return an error without committing a partial subset of changes.
* **Wire contract constraints**:
  * `PATCH` request schemas **MUST NOT** declare top-level `required` properties, except an explicit `discriminator.propertyName` on a polymorphic `oneOf` or `anyOf` union schema. Every mutable field **MUST** be optional so callers can update any subset.
  * `PATCH` request schemas **MUST** reject unknown properties (`additionalProperties: false`, or `unevaluatedProperties: false` on composed schemas) so typos and unsupported fields fail explicitly with `422 Unprocessable Content` (RFC 9457 Problem Details, `VALIDATION_FAILED`) rather than being silently dropped. Intentional open-dictionary maps that declare typed `additionalProperties` without fixed resource `properties` are exempt.
  * `PATCH` request schemas **SHOULD** reject empty patch payloads (`{}`) with `minProperties: 1` unless the endpoint explicitly documents empty-patch no-op behavior. An empty patch rejected under `minProperties: 1` **MUST** fail with `422 Unprocessable Content` (`VALIDATION_FAILED`).
* **Error status codes**: A request body that is not syntactically valid JSON **MUST** return `400 Bad Request` ([RFC 9110 §15.5.1](https://www.rfc-editor.org/rfc/rfc9110#section-15.5.1)). A well-formed JSON body that fails schema or field validation (unknown properties, `null` on a non-nullable field, wrong types, or an empty patch under `minProperties: 1`) **MUST** return `422 Unprocessable Content` ([RFC 9110 §15.5.21](https://www.rfc-editor.org/rfc/rfc9110#section-15.5.21)) as RFC 9457 Problem Details with error code `VALIDATION_FAILED`.

## Examples

### Standard CRUD resource lifecycle

**Good** — plural kebab-case collection with `GET 200`, `POST 201` + `Location`, direct item `GET 200`, `PATCH 200` returning the updated resource, and `DELETE 204` with no body:

```yaml theme={null}
paths:
  /v1/projects/{projectId}/webhooks:
    get:
      summary: List project webhooks
      responses:
        "200":
          description: Webhook collection
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookListResponse"
    post:
      summary: Create a project webhook
      responses:
        "201":
          description: Created webhook
          headers:
            Location:
              description: Canonical URL for the created webhook
              schema:
                type: string
                format: uri
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Webhook"
  /v1/projects/{projectId}/webhooks/{webhookId}:
    get:
      summary: Get a project webhook
      responses:
        "200":
          description: Webhook details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Webhook"
    patch:
      summary: Update a project webhook
      responses:
        "200":
          description: Updated webhook
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Webhook"
    delete:
      summary: Delete a project webhook
      responses:
        "204":
          description: Webhook deleted
```

### Scoped collection list with hoisted canonical `GET`

**Good** — `GET /v1/organizations/{organizationId}/projects` lists `Project` items and pairs with the hoisted canonical item endpoint `GET /v1/projects/{projectId}`:

```http theme={null}
GET /v1/organizations/org_01h455vb4pex5vsknk084sn02s/projects HTTP/1.1
Host: api.photon.codes
```

```json theme={null}
{
  "items": [
    {
      "id": "prj_01h455vb4pex5vsknk084sn02q",
      "organizationId": "org_01h455vb4pex5vsknk084sn02s",
      "name": "Acme Billing",
      "createdAt": "2026-11-26T10:00:00Z"
    }
  ],
  "nextPageToken": "eyJjIjoiMjAyNi0xMS0yNiJ9"
}
```

```http theme={null}
GET /v1/projects/prj_01h455vb4pex5vsknk084sn02q HTTP/1.1
Host: api.photon.codes
```

```json theme={null}
{
  "id": "prj_01h455vb4pex5vsknk084sn02q",
  "organizationId": "org_01h455vb4pex5vsknk084sn02s",
  "name": "Acme Billing",
  "createdAt": "2026-11-26T10:00:00Z"
}
```

### Singleton resource and custom item action

**Good** — singleton `agent-profile` pairs `PATCH` with `GET` on the same path, and custom item action `POST .../api-keys/{apiKeyId}/revoke` pairs with `GET .../api-keys/{apiKeyId}`:

```yaml theme={null}
paths:
  /v1/projects/{projectId}/agent-profile:
    get:
      summary: Get project agent profile
      responses:
        "200":
          description: Agent profile
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AgentProfile"
    patch:
      summary: Update project agent profile
      responses:
        "200":
          description: Updated agent profile
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AgentProfile"
  /v1/projects/{projectId}/api-keys/{apiKeyId}:
    get:
      summary: Get a project API key
      responses:
        "200":
          description: API key details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiKey"
  /v1/projects/{projectId}/api-keys/{apiKeyId}/revoke:
    post:
      summary: Revoke a project API key
      responses:
        "200":
          description: Revoked API key
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiKey"
```

### Safe browser redirect handoffs and protocol-mandated callbacks

**Good** — outbound relay (`GET .../redirect`): create the external authorization attempt during the preceding `POST`, and have the relay `GET` read-only reuse the active unconsumed attempt to return `302 Found`. Repeated `GET` requests from browser prefetching, enterprise URL scanners, or double-clicks redirect to the same active attempt without invalidating the in-flight workflow:

```http theme={null}
POST /v1/projects/prj_01h455vb4pex5vsknk084sn02q/integrations HTTP/1.1
Host: api.photon.codes
Idempotency-Key: 9b2d8a64-3f7e-4c1e-8d0a-123456789abc
Content-Type: application/json
```

The `POST` response returns `202 Accepted` with an `Operation` whose `nextAction.url` points to the read-only relay route. Following that link performs no state mutation:

```http theme={null}
GET /v1/operations/op_01h455vb4pex5vsknk084sn02r/redirect HTTP/1.1
Host: api.photon.codes
```

```http theme={null}
HTTP/1.1 302 Found
Location: https://provider.example.com/oauth/authorize?state=st_01h455vb4pex5vsknk084sn02t
Cache-Control: no-store
```

**Good** — protocol-mandated inbound browser callback (`GET .../callback`): when the external provider redirects the browser back after OAuth or integration approval, the callback verifies the short-lived, single-use, unpredictable correlation token against the initiating session, converges on concurrent or replayed hits without creating or replacing attempts, and responds only with a non-cacheable `302 Found`:

```http theme={null}
GET /v1/integrations/callback?attempt=att_01h455vb4pex5vsknk084sn02u HTTP/1.1
Host: api.photon.codes
```

```http theme={null}
HTTP/1.1 302 Found
Location: https://provider.example.com/setup/continue
Cache-Control: no-store
Referrer-Policy: no-referrer
```

**Bad** — creating or rotating a fresh authorization attempt and overwriting the operation's active state on every `GET /v1/operations/{operationId}/redirect`, exposing state-mutating verbs (such as `/revoke` or `/resume`) or `Idempotency-Key` headers on `GET`, or using a JSON `GET` endpoint to complete a state transition:

```yaml theme={null}
paths:
  /v1/operations/{operationId}/redirect:
    get:
      summary: Mutates or replaces the active authorization attempt on every GET
      parameters:
        - name: Idempotency-Key
          in: header
          schema:
            type: string
      responses:
        "302":
          description: Redirects to a newly minted attempt, invalidating earlier links
  /v1/integrations/resume:
    get:
      summary: Uses a state-mutating verb instead of /callback on GET
      responses:
        "302":
          description: Redirects after mutating state
  /v1/projects/{projectId}/api-keys/{apiKeyId}/revoke:
    get:
      summary: Uses GET instead of POST for a state-mutating action
      responses:
        "200":
          description: Revoked API key
```

### Partial updates (`PATCH`)

**Good** — RFC 7396 JSON Merge Patch over `application/json`: updating `displayName`, clearing nullable `bio` with explicit `null`, and recursively merging `notifications.emailEnabled` while leaving omitted fields (such as `notifications.smsEnabled`) untouched:

```http theme={null}
PATCH /v1/projects/prj_01h455vb4pex5vsknk084sn02q/agent-profile HTTP/1.1
Host: api.photon.codes
Content-Type: application/json
```

```json theme={null}
{
  "displayName": "Support Assistant",
  "bio": null,
  "notifications": {
    "emailEnabled": false
  }
}
```

Its request schema keeps every mutable field optional, marks clearable fields nullable, forbids unknown properties, and rejects empty patches:

```yaml theme={null}
UpdateAgentProfileRequest:
  type: object
  additionalProperties: false
  minProperties: 1
  properties:
    displayName:
      type: string
      minLength: 1
    bio:
      type:
        - string
        - "null"
    notifications:
      type: object
      additionalProperties: false
      minProperties: 1
      properties:
        emailEnabled:
          type: boolean
        smsEnabled:
          type: boolean
```

**Bad** — RFC 6902 `application/json-patch+json`, `updateMask` parameters or fields, required top-level `PATCH` properties, or open schemas that silently accept unknown fields:

```yaml theme={null}
paths:
  /v1/projects/{projectId}:
    patch:
      summary: Uses RFC 6902 patch array, updateMask, required fields, and open properties
      parameters:
        - name: updateMask
          in: query
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json-patch+json:
            schema:
              type: array
              items:
                type: object
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                fieldMask:
                  type: array
                  items:
                    type: string
```

### Non-conformant patterns

**Bad** — CRUD verbs in URL segments, `camelCase`/`snake_case` paths, both `PUT` and `PATCH` on one path, `GET` with `requestBody`, collection `DELETE` with `requestBody`, collection `POST` returning only `200`, `PATCH 204`, `DELETE 204` with a response body, and an addressable list with no item `GET`:

```yaml theme={null}
paths:
  /v1/projects/create-project:
    post:
      summary: Embeds CRUD verb in path
  /v1/projects/{projectId}/apiKeys:
    get:
      summary: Uses camelCase path segment and lacks single-item GET
      requestBody:
        content:
          application/json:
            schema:
              type: object
      responses:
        "200":
          description: List of API keys
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: "#/components/schemas/ApiKey"
    post:
      summary: Collection creation returning only 200 instead of 201 or 202
      responses:
        "200":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiKey"
    delete:
      summary: Collection DELETE with requestBody
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                apiKeyIds:
                  type: array
                  items:
                    type: string
      responses:
        "204":
          description: Deleted with disallowed body
          content:
            application/json:
              schema:
                type: object
  /v1/projects/{projectId}/agent_profile:
    put:
      summary: Declares both PUT and PATCH on one path and uses snake_case
      responses:
        "200":
          description: Replaced
    patch:
      summary: Partial update returning 204 instead of 200 with body
      responses:
        "204":
          description: No content
```

## Changelog

* **2026-11-26**: Approved and published as `ADS-0005`.
* **2026-11-26**: Codified RFC 9110 safe, side-effect-free semantics for `GET` and `HEAD` in §1, added browser redirect handoff guidance, and prohibited `Idempotency-Key` header parameters and unmistakable state-mutating terminal action verbs on `GET` and `HEAD`.
* **2026-11-27**: Clarified the narrow exception for protocol-mandated inbound browser callbacks (`GET .../callback` per RFC 6749 OAuth, SSO, and third-party integration redirects) with single-use initiator-bound correlation, convergent replay, and non-cacheable `302` redirect guardrails, while keeping outbound `/redirect` relays and regular `GET` operations strictly side-effect-free.
* **2026-11-28**: Codified RFC 7396 JSON Merge Patch semantics for `PATCH` partial updates in §6 (three-state omitted/`null`/value rules, recursive plain-object merge vs wholesale array/map replacement, atomicity, prohibition of RFC 6902 JSON Patch and field masks, optional top-level fields, and strict unknown-property rejection), returning `422 Unprocessable Content` (`VALIDATION_FAILED`) for schema-invalid payloads and `400 Bad Request` for malformed JSON.

## Feedback

Found a Photon API that does not follow this standard, or have a suggestion to improve it? [Open an issue](https://github.com/photon-hq/api-design-standards/issues/new) in `photon-hq/api-design-standards` (we do not accept external pull requests).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.