{
	"openapi": "3.1.0",
	"info": {
		"title": "dak.dev Agent API",
		"version": "1.0.0",
		"description": "Public version 1 HTTP and MCP surfaces on dak.dev. Send X-Dak-API-Version: 1 to pin this contract. See /auth.md for authentication and the versioning, deprecation, error, and rate-limit policies.",
		"contact": {
			"name": "Dak Washbrook",
			"email": "hey@dak.dev",
			"url": "https://dak.dev"
		}
	},
	"servers": [
		{
			"url": "https://dak.dev",
			"description": "Production"
		}
	],
	"paths": {
		"/rpc/ping": {
			"get": {
				"operationId": "ping",
				"summary": "Check dak.dev RPC availability",
				"description": "Returns a small JSON health response.",
				"parameters": [
					{
						"$ref": "#/components/parameters/ApiVersion"
					}
				],
				"responses": {
					"200": {
						"description": "RPC service is available.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/PingResponse"
								}
							}
						}
					},
					"500": {
						"description": "The RPC service could not respond.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					}
				}
			}
		},
		"/api/icloud-mcp/{transport}": {
			"post": {
				"operationId": "icloudMcp",
				"summary": "iCloud MCP transport",
				"description": "Connect to dak.dev iCloud MCP with a per-credential bearer token created in the iCloud MCP UI.",
				"security": [
					{
						"bearerAuth": []
					}
				],
				"parameters": [
					{
						"$ref": "#/components/parameters/McpTransport"
					},
					{
						"$ref": "#/components/parameters/ApiVersion"
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/McpRequest"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "MCP JSON-RPC response or Server-Sent Events stream.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/McpResponse"
								}
							},
							"text/event-stream": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"400": {
						"description": "The MCP request is invalid.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					},
					"401": {
						"description": "Missing or invalid bearer token.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					},
					"403": {
						"description": "The token cannot access this resource.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					},
					"404": {
						"description": "The MCP transport does not exist.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					},
					"405": {
						"description": "The HTTP method is not supported.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					},
					"429": {
						"description": "The transport rate limit has been exceeded.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						},
						"headers": {
							"Retry-After": {
								"description": "Seconds to wait before retrying.",
								"schema": {
									"type": "integer",
									"minimum": 1
								}
							}
						}
					},
					"500": {
						"description": "The transport could not complete the request.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					}
				}
			}
		},
		"/api/feed/{transport}": {
			"post": {
				"operationId": "feedMcp",
				"summary": "Feed MCP transport",
				"description": "Connect to the operator-managed Feed MCP transport with MCP_ADMIN_TOKEN.",
				"security": [
					{
						"bearerAuth": []
					}
				],
				"parameters": [
					{
						"$ref": "#/components/parameters/McpTransport"
					},
					{
						"$ref": "#/components/parameters/ApiVersion"
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/McpRequest"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "MCP JSON-RPC response or Server-Sent Events stream.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/McpResponse"
								}
							},
							"text/event-stream": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"400": {
						"description": "The MCP request is invalid.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					},
					"401": {
						"description": "Missing or invalid bearer token.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					},
					"403": {
						"description": "The token cannot access this resource.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					},
					"404": {
						"description": "The MCP transport does not exist.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					},
					"405": {
						"description": "The HTTP method is not supported.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					},
					"429": {
						"description": "The transport rate limit has been exceeded.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						},
						"headers": {
							"Retry-After": {
								"description": "Seconds to wait before retrying.",
								"schema": {
									"type": "integer",
									"minimum": 1
								}
							}
						}
					},
					"500": {
						"description": "The transport could not complete the request.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					}
				}
			}
		},
		"/api/newsletter-vibes/{transport}": {
			"post": {
				"operationId": "newsletterVibesMcp",
				"summary": "Newsletter vibes MCP transport",
				"description": "Connect to the operator-managed newsletter-vibes MCP transport with MCP_ADMIN_TOKEN.",
				"security": [
					{
						"bearerAuth": []
					}
				],
				"parameters": [
					{
						"$ref": "#/components/parameters/McpTransport"
					},
					{
						"$ref": "#/components/parameters/ApiVersion"
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/McpRequest"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "MCP JSON-RPC response or Server-Sent Events stream.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/McpResponse"
								}
							},
							"text/event-stream": {
								"schema": {
									"type": "string"
								}
							}
						}
					},
					"400": {
						"description": "The MCP request is invalid.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					},
					"401": {
						"description": "Missing or invalid bearer token.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					},
					"403": {
						"description": "The token cannot access this resource.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					},
					"404": {
						"description": "The MCP transport does not exist.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					},
					"405": {
						"description": "The HTTP method is not supported.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					},
					"429": {
						"description": "The transport rate limit has been exceeded.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						},
						"headers": {
							"Retry-After": {
								"description": "Seconds to wait before retrying.",
								"schema": {
									"type": "integer",
									"minimum": 1
								}
							}
						}
					},
					"500": {
						"description": "The transport could not complete the request.",
						"content": {
							"application/problem+json": {
								"schema": {
									"$ref": "#/components/schemas/Problem"
								}
							}
						}
					}
				}
			}
		}
	},
	"components": {
		"securitySchemes": {
			"bearerAuth": {
				"type": "http",
				"scheme": "bearer",
				"description": "https://dak.dev/auth.md#mcp-bearer-tokens"
			}
		},
		"parameters": {
			"ApiVersion": {
				"name": "X-Dak-API-Version",
				"in": "header",
				"required": false,
				"description": "Optional contract version pin. Version 1 is the current stable API.",
				"schema": {
					"type": "integer",
					"const": 1,
					"default": 1
				}
			},
			"McpTransport": {
				"name": "transport",
				"in": "path",
				"required": true,
				"description": "MCP Streamable HTTP transport selector.",
				"schema": {
					"type": "string",
					"enum": [
						"mcp"
					]
				}
			}
		},
		"schemas": {
			"PingResponse": {
				"type": "object",
				"additionalProperties": false,
				"required": [
					"ping"
				],
				"properties": {
					"ping": {
						"type": "string",
						"const": "pong"
					}
				}
			},
			"McpRequest": {
				"type": "object",
				"required": [
					"jsonrpc",
					"method"
				],
				"properties": {
					"jsonrpc": {
						"type": "string",
						"const": "2.0"
					},
					"id": {
						"type": [
							"string",
							"number",
							"null"
						]
					},
					"method": {
						"type": "string",
						"minLength": 1
					},
					"params": {}
				}
			},
			"McpResponse": {
				"type": "object",
				"required": [
					"jsonrpc"
				],
				"properties": {
					"jsonrpc": {
						"type": "string",
						"const": "2.0"
					},
					"id": {
						"type": [
							"string",
							"number",
							"null"
						]
					},
					"result": {},
					"error": {
						"type": "object",
						"required": [
							"code",
							"message"
						],
						"properties": {
							"code": {
								"type": "integer"
							},
							"message": {
								"type": "string"
							},
							"data": {}
						}
					}
				}
			},
			"Problem": {
				"type": "object",
				"additionalProperties": false,
				"required": [
					"type",
					"title",
					"status",
					"detail",
					"instance",
					"code",
					"resolution"
				],
				"properties": {
					"type": {
						"type": "string",
						"format": "uri-reference"
					},
					"title": {
						"type": "string"
					},
					"status": {
						"type": "integer",
						"minimum": 400,
						"maximum": 599
					},
					"detail": {
						"type": "string"
					},
					"instance": {
						"type": "string",
						"format": "uri-reference"
					},
					"code": {
						"type": "string",
						"pattern": "^[A-Z_]+$"
					},
					"resolution": {
						"type": "string"
					}
				}
			}
		}
	}
}