API reference
Use MCP to discover approved phone data, then read it through MCP or REST. Public catalog and documentation requests need no account. For setup, start with Getting started.
Authenticate
Connect a Streamable HTTP MCP client to:
https://myself.md/mcpUse protected-resource metadata and authorization-server metadata to find the issuer and registration, authorization and token endpoints.
Sign in with the authorization-code flow and PKCE. Request the myselfmd scope for the MCP resource. The owner completes sign-in and consent, pairs a phone, and approves the profiles and data types the agent can read. An agent cannot grant itself access, and a shared API key cannot replace consent.
Private requests need an agent OAuth bearer token. Missing or expired tokens return HTTP 401 with a WWW-Authenticate discovery header. Keep tokens out of URLs and public source code.
Discover available data
For a step-by-step agent workflow and examples, read Query and export approved data with MCP.
After MCP initialization, call tools/list for the current schemas, inputs and limits.
- Discover the owner’s paired phones.
- Call
get_phone_data_catalogfor available data types and approved profiles. - Choose a supported type covered by the profile and its data grants.
- Call
query_phone_data, then pollget_phone_requestfor the result.
Filter get_phone_data_catalog with optional domains, profileId, and detail: "summary" to inspect type counts and grants; request full detail to obtain exact type IDs. Cloud discovery list_cloud_exports accepts device/profile and inclusive-start/exclusive-end day filters and returns {exports, nextCursor} metadata pages.
Use waitMs (0–25000 milliseconds) on query initiation or asynchronous status tools to wait for a pending state change. Owner-action states return immediately; follow retryAfterMs. Waiting does not reserve another allowance or change retry identity. REST query status accepts ?waitMs=25000.
For scalar summaries, pass aggregation: {operation: "sum", field: "quantity", groupBy: "day"} to query_phone_data. Operations are count, sum, avg, min and max; numeric operations require an explicit scalar field path inside native. Optional unitField defaults to native unit; different sources and units remain separate buckets. Count counts records, avg is unweighted, UTC buckets use record start, and intervals are not prorated or deduplicated. Nested series are not flattened. Empty days are omitted, not zero-filled. Each page reports scanned/skipped counts and coverage; keep warnings and follow nextCursor. Daily pages cover up to 31 days; interval grouping supports at most 31 days. A scan exceeding 10000 records, 200 source pages or 50 source/unit buckets fails without partial totals. Requires catalog dataQuery.aggregation version 1; older phones need an app update.
Use the returned identifiers rather than guessing them. create_phone_export_profile submits a profile for owner review; it does not grant access.
A phone read may need the app open and OS permissions enabled. Sign-in, permission prompts, purchases and system sharing require the owner on the device. Empty HealthKit results can mean missing records or limited permission; they do not prove authorization.
Browse Datasets before connecting a phone. This does not authorize private reads.
Query through REST
Submit a query to POST /api/v1/queries. Use the JSON arguments from query_phone_data, leaving out requestKey. The OpenAPI specification lists the request and response fields.
Save those arguments in query.json, then send:
curl https://myself.md/api/v1/queries \
-H "Authorization: Bearer $MYSELF_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $QUERY_KEY" \
--data @query.jsonSet QUERY_KEY to a unique value of 1–200 characters. Use the phone, profile and type discovered through MCP.
HTTP 202 means the request was accepted. The response includes requestId, status and expiresAt; the Location header points to GET /api/v1/queries/{requestId}. Set REQUEST_ID to the returned requestId, then poll with the same authorization:
curl "https://myself.md/api/v1/queries/$REQUEST_ID" \
-H "Authorization: Bearer $MYSELF_TOKEN"queuedorrunning: wait for the phone.complete: read the result page and capture warnings.failed: inspect the error.
Request metadata and results expire after five minutes. Wait for complete before treating a read as successful. REST and MCP share validation, permissions, billing, history and phone execution.
Retry safely
If a response is lost, resend the same arguments with the same Idempotency-Key. A live retry returns the original request without another phone job or billing reservation. Keys are scoped to the account and agent OAuth client.
- Changing the arguments with the same key fails.
- Revoked grants or an unavailable original request fail rather than dispatching the old request again.
- While the original request is initializing, a retry may fail. Check its result before using a new key.
The service retains an activity fingerprint for 90 days to prevent redispatch after a job is forgotten, expires, or the service restarts. Keep keys unique beyond that period. For any write with an uncertain outcome, check its status before retrying with a new identifier.
Validation and permission failures return HTTP 422 with an error. Authentication failures return 401 or 403.
Use the SDK
The JavaScript SDK has no runtime dependencies. Import createMyselfClient from myself-md-sdk, or use the standalone module.
Public methods need no token:
The website's bundled JavaScript client supports docs({ guide: 'apple-health-claude-mcp' }), docs({ guide: 'android-health-connect-mcp' }), docs({ guide: 'whoop-claude-mcp' }). Older npm releases may support only docs(); read the guide's public HTTP URL instead. The optional guide selector is also available on get_public_documentation and WebMCP myself_public_documentation.
health()checks service availability.config()reads public configuration.docs()reads the getting-started guide.datasets({ limit: 1 })reads a catalog page.
Pass nextCursor as cursor to get the next catalog page. Stop when nextCursor is null and hasMore is false. The catalog describes adapter capabilities; it contains no personal records.
For private queries, create a client with an existing agent token:
import { createMyselfClient } from 'myself-md-sdk';
const myself = createMyselfClient({ token });
const job = await myself.query(input, idempotencyKey);
const status = await myself.request(job.requestId);Use the discovered query arguments for input and the same retry rules described above. request() reads the current status once; continue polling until the job finishes. For phone results, follow every returned pagination cursor and review capture warnings.
Browsers with WebMCP expose myself_public_documentation and myself_dataset_catalog through document.modelContext, with navigator.modelContext as a compatibility fallback.
Use the CLI
The official CLI requires Node.js 22.13 or later:
npx myself-md-cli helpOr install it globally with npm install --global myself-md-cli and run myself help.
Use health, config, docs and openapi for public reads. tools lists the live MCP schemas; call TOOL reads a JSON argument object from standard input. Private commands need an existing owner-approved OAuth token in MYSELF_TOKEN. MYSELF_URL selects an HTTPS service origin. The CLI does not store tokens or grant access.
A standalone download runs with node myself.mjs help; review the file before running it. Read its dependency notices. The repository source is scripts/myself.js; after installing dependencies, run npm run myself -- help or npm run myself -- call TOOL. Both distributions expose the same public reads and authorized MCP operations. Check get_phone_request to verify that queued phone work completed.
Rate limits
Public OpenAPI reads share a limit of 120 requests per 60 seconds per source IP. REST queries, including polling, have a separate limit of 120 per minute per account and agent client.
These limits apply locally to each Node process or Worker isolate. They are best-effort abuse limits, not global account quotas. Shared networks share a public bucket, and restarting a process resets its window.
Read the response headers to check the current window:
RateLimit-Limit: request limit.RateLimit-Remaining: requests left.RateLimit-Reset: seconds until reset.RateLimit-Policy: window policy.
HTTP 429 returns a JSON error and Retry-After in seconds. Wait that long before retrying, and avoid concurrent retries. The X-RateLimit compatibility headers describe the same quota, with the reset expressed in epoch seconds. Private MCP and owner APIs keep their existing authorization and limits.
API versions
Public discovery reads use /v1, such as /v1/health and /v1/config. Unversioned URLs remain aliases for the same contract. Clients should ignore unknown response fields; a breaking change requires a new major path.
Deprecations are announced here at least 90 days before removal. Affected routes return Deprecation and Sunset headers. No v1 route is currently deprecated. MCP negotiates its protocol version separately and uses the live tools/list schemas.
The OpenAPI specification covers public discovery and REST phone queries. The agent catalog links to the MCP server card for connection metadata. These documents expose no private records; discover current private operations through authenticated tools/list.
Export schema v1
Source records and explicit time series. Preserves native fields, every available observation, timestamps, precision and metadata.
Initial export contract. No summaries, resampling, deduplication or unit conversion. Saved profiles keep their selected version. JSON exports contain a schema identifier and records array; JSONL exports contain one record per line. Empty objects in these definitions allow any JSON value. The example uses fictional data.
JSON export definition:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "myself.md export v1",
"type": "object",
"required": [
"schema",
"records"
],
"properties": {
"schema": {
"const": "myself.md.export.v1"
},
"records": {
"type": "array",
"items": {
"type": "object",
"required": [
"domain",
"type",
"source",
"start",
"end",
"native"
],
"properties": {
"domain": {
"enum": [
"health",
"time",
"location"
]
},
"type": {
"type": "string"
},
"source": {
"type": "string"
},
"start": {
"type": [
"string",
"null"
]
},
"end": {
"type": [
"string",
"null"
]
},
"native": {},
"timeSeries": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "object",
"required": [
"timestamp",
"value"
],
"properties": {
"timestamp": {
"type": [
"string",
"null"
]
},
"value": {},
"unit": {
"type": "string"
},
"metadata": {},
"offsetSeconds": {
"type": "number"
}
},
"additionalProperties": true
}
}
}
},
"additionalProperties": true
}
}
},
"additionalProperties": true
}JSONL record definition:
{
"type": "object",
"required": [
"domain",
"type",
"source",
"start",
"end",
"native"
],
"properties": {
"domain": {
"enum": [
"health",
"time",
"location"
]
},
"type": {
"type": "string"
},
"source": {
"type": "string"
},
"start": {
"type": [
"string",
"null"
]
},
"end": {
"type": [
"string",
"null"
]
},
"native": {},
"timeSeries": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "object",
"required": [
"timestamp",
"value"
],
"properties": {
"timestamp": {
"type": [
"string",
"null"
]
},
"value": {},
"unit": {
"type": "string"
},
"metadata": {},
"offsetSeconds": {
"type": "number"
}
},
"additionalProperties": true
}
}
}
},
"additionalProperties": true
}Example JSON export:
{
"schema": "myself.md.export.v1",
"records": [
{
"domain": "health",
"type": "HeartRate",
"source": "native",
"start": "2026-10-08T08:00:00.000Z",
"end": "2026-10-08T08:00:00.000Z",
"native": {
"quantity": 70,
"unit": "count/min"
},
"timeSeries": {
"samples": [
{
"timestamp": "2026-10-08T08:00:00.000Z",
"value": 70,
"unit": "count/min"
}
]
}
}
]
}Privacy and help
Blocking an agent or revoking its grant stops future reads. Copies already delivered to an AI provider follow that provider’s retention policy.
get_privacy_policy returns the shared policy and support contacts under MCP account authentication, without a data grant. Read the privacy policy before sharing sensitive records. myself.md provides data access, not medical advice.
See pricing and common questions for product details, or contact us for help. The source code is public.