> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://documentation.sayari.com/api/api-reference/resource/save-entity/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://documentation.sayari.com/_mcp/server. # Save Entity POST https://api.sayari.com/v1/resource/entity Content-Type: application/json Save an entity to a project. Reference: https://documentation.sayari.com/api/api-reference/resource/save-entity ## Authentication - OAuth2 — send the obtained token as `Authorization: Bearer ` ## Servers - `https://api.sayari.com` (Production, default) - `https://api.internal.sayari.com` (Dev) - `https://api.uk.sayari.com` (Production_UK) ## Request ### Body (application/json) This endpoint expects a SaveEntityRequest. - `type` (enum, required) - Allowed values: `entity` - `project` (string, required) — The project identifier. - `entity_id` (string, required) — The entity identifier. - `custom_fields` (any, required) — This property is in beta and is subject to change. It is provided for early access and testing purposes only. custom user key/value pairs (key must be prefixed with "custom\_" and value must be "string" type) ## Response ### 200 - `data` (EntityResponseData, required) ## Errors ### 400 Bad Request - `any` ### 401 Unauthorized - `any` ### 404 Not Found - `status` (integer, required) - `message` (list of string, required) - `success` (boolean, required) ### 405 Method Not Allowed - `status` (integer, required) - `message` (list of string, required) - `success` (boolean, required) ### 429 Rate Limit Exceeded - `any` ### 500 Internal Server Error - `any` ## Types ### EntityResponseData - `type` (enum, required) - Allowed values: `entity` - `id` (string, required) - `project` (string, required) - `label` (string, required) - `created` (string, required) - `updated` (string, required) - `updated_by` (string, required) - `version` (integer, required) - `entity_id` (string, required) - `tag_ids` (list of string, required) - `case_status` (string, required) ## Examples **Request** ```json { "type": "entity", "project": "GNJbkG", "entity_id": "Zk0qOaM2SSYg_ZhsljykMQ", "custom_fields": { "properties": { "custom_name": "Victoria Beckham" } } } ``` **Response** ```json { "data": { "type": "entity", "id": "Ywk6qw", "project": "GNJbkG", "label": "HOME DEPOT, U. S. A., INC.", "created": "2024-03-12 16:12:38.528362+00", "updated": "2024-03-12 16:12:38.528362+00", "updated_by": "auth0|5e45bd8caccd890e68147513", "version": 0, "entity_id": "n9SA4T_33tDmLtS8BhC6Zg", "tag_ids": [], "case_status": "not_assigned" } } ``` **SDK Code** ```python import requests url = "https://api.sayari.com/v1/resource/entity" payload = { "type": "entity", "project": "GNJbkG", "entity_id": "Zk0qOaM2SSYg_ZhsljykMQ", "custom_fields": { "properties": { "custom_name": "Victoria Beckham" } } } headers = { "Authorization": ".", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```typescript import { SayariClient, Sayari } from "sayari"; const sayari = new SayariClient({ clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET" }); await sayari.resource.saveEntity({ type: Sayari.ResourceType.Entity, project: "GNJbkG", entityId: "Zk0qOaM2SSYg_ZhsljykMQ" }); ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.sayari.com/v1/resource/entity" payload := strings.NewReader("{\n \"type\": \"entity\",\n \"project\": \"GNJbkG\",\n \"entity_id\": \"Zk0qOaM2SSYg_ZhsljykMQ\",\n \"custom_fields\": {\n \"properties\": {\n \"custom_name\": \"Victoria Beckham\"\n }\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", ".") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.sayari.com/v1/resource/entity") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = '.' request["Content-Type"] = 'application/json' request.body = "{\n \"type\": \"entity\",\n \"project\": \"GNJbkG\",\n \"entity_id\": \"Zk0qOaM2SSYg_ZhsljykMQ\",\n \"custom_fields\": {\n \"properties\": {\n \"custom_name\": \"Victoria Beckham\"\n }\n }\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.sayari.com/v1/resource/entity") .header("Authorization", ".") .header("Content-Type", "application/json") .body("{\n \"type\": \"entity\",\n \"project\": \"GNJbkG\",\n \"entity_id\": \"Zk0qOaM2SSYg_ZhsljykMQ\",\n \"custom_fields\": {\n \"properties\": {\n \"custom_name\": \"Victoria Beckham\"\n }\n }\n}") .asString(); ``` ```php request('POST', 'https://api.sayari.com/v1/resource/entity', [ 'body' => '{ "type": "entity", "project": "GNJbkG", "entity_id": "Zk0qOaM2SSYg_ZhsljykMQ", "custom_fields": { "properties": { "custom_name": "Victoria Beckham" } } }', 'headers' => [ 'Authorization' => '.', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.sayari.com/v1/resource/entity"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "."); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"type\": \"entity\",\n \"project\": \"GNJbkG\",\n \"entity_id\": \"Zk0qOaM2SSYg_ZhsljykMQ\",\n \"custom_fields\": {\n \"properties\": {\n \"custom_name\": \"Victoria Beckham\"\n }\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": ".", "Content-Type": "application/json" ] let parameters = [ "type": "entity", "project": "GNJbkG", "entity_id": "Zk0qOaM2SSYg_ZhsljykMQ", "custom_fields": ["properties": ["custom_name": "Victoria Beckham"]] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.sayari.com/v1/resource/entity")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```