---
title: "Create Learning"
method: POST
path: "/learnings"
tags: ["Learnings"]
---

# Create Learning

`POST /learnings`

Create a new learning record. For the identity-keyed learning types (`user_profile`, `user_memory`, `session_context`, `entity_memory`) the record id is derived deterministically from the identity fields so it reconciles with what the agent reads/writes — provide those fields (else 422), and if a record already exists the request is rejected with 409 (use PATCH to update it). Other types get a generated id. For a scoped (non-admin) caller, the body's `user_id` must be omitted/null or match the caller (mismatch → 403); admins and unscoped callers may set any `user_id`.

## Query parameters

- `db_id` string, nullable — Database ID to use
- `table` string, nullable — The database table to use (requires db_id)

## Request body

- LearningCreate — Request body for creating a learning record.
  - `learning_type` string, required — Type of learning (e.g. 'user_profile', 'entity_memory')
  - `content` object, required — The learning content payload
  - `namespace` string, nullable — Namespace for scoping ('user', 'global', or custom)
  - `user_id` string, nullable — Associated user ID. When the request is authenticated, must match the JWT subject or be omitted/null (which creates a global / non-user-scoped record).
  - `agent_id` string, nullable — Associated agent ID
  - `team_id` string, nullable — Associated team ID
  - `session_id` string, nullable — Associated session ID
  - `entity_id` string, nullable — Associated entity ID
  - `entity_type` string, nullable — Entity type
  - `metadata` object, nullable — Optional metadata

## Response `201`

Successful Response

- LearningResponse — A single learning record as returned by the API.
  - `learning_id` string, required — Unique identifier for the learning record
  - `learning_type` string, required — Type of learning (e.g. 'user_profile', 'entity_memory')
  - `namespace` string, nullable — Namespace for scoping ('user', 'global', or custom)
  - `user_id` string, nullable — Associated user ID
  - `agent_id` string, nullable — Associated agent ID
  - `team_id` string, nullable — Associated team ID
  - `session_id` string, nullable — Associated session ID
  - `entity_id` string, nullable — Associated entity ID (for entity-specific learnings)
  - `entity_type` string, nullable — Entity type (e.g. 'person', 'company')
  - `content` object, nullable — The learning content payload
  - `metadata` object, nullable — Optional metadata
  - `created_at` integer, nullable — Creation timestamp (Unix epoch seconds)
  - `updated_at` integer, nullable — Last update timestamp (Unix epoch seconds)

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `404` — Not Found
- `422` — Validation Error
- `500` — Internal Server Error

---

[API](https://skmtc.net/agno/apis/agno-api-reference.md) · [All operations](https://skmtc.net/agno/apis/agno-api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/agno/agno-api-reference/revisions/5f6149d395d0/schema)
