> 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/attributes/post-attribute/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://documentation.sayari.com/_mcp/server. # Post Attribute POST https://api.sayari.com/v1/attribute Content-Type: application/json Adds a new attribute to an entity in the project Reference: https://documentation.sayari.com/api/api-reference/attributes/post-attribute ## 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 an AddAttribute. - `entity` (string, required) — entity ID - `type` (string, required) — type of additional information - `value` (any, required) — value of additional information in JSON format - `date` (string, optional) — as of date of the attribute - `from_date` (string, optional) — start date of the attribute - `to_date` (string, optional) — end date of the attribute ## Response ### 200 - `data` (AttributeResponseData, required) ## Errors ### 400 Bad Request - `any` ### 401 Unauthorized - `any` ### 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` ### 502 Bad Gateway - `any` ### 520 Connection Error - `any` ## Types ### AttributeResponseData - `value` (any, required) - `properties` (list of AttributeProperties, required) ### AttributeProperties - `editable` (boolean, required) - `record_count` (integer, required) - `id` (string, required) ## Examples **Request** ```json { "entity": "zq04axX2dLn9tE6W6Q8Qhg", "type": "address", "value": { "street1": "1600 Pennsylvania Avenue NW", "city": "Washington DC", "state": "Washington DC", "postalCode": "20500", "country": "US" }, "date": "2024-02-15", "from_date": "2024-01-01", "to_date": "2024-04-30" } ``` **Response** ```json { "data": { "value": { "street1": "1600 Pennsylvania Avenue NW", "city": "Washington DC", "state": "Washington DC", "postalCode": "20500", "country": "US" }, "properties": [ { "editable": true, "record_count": 0, "id": "enEwNGF4WDJkTG45dEU2VzZROFFoZ3xhZGRyZXNzfDBwbEVCMHxVNzhzN21yOUVFTThIZ3pwREM3UDFB" } ] } } ``` **SDK Code** ```python import requests url = "https://api.sayari.com/v1/attribute" payload = { "entity": "zq04axX2dLn9tE6W6Q8Qhg", "type": "address", "value": { "street1": "1600 Pennsylvania Avenue NW", "city": "Washington DC", "state": "Washington DC", "postalCode": "20500", "country": "US" }, "date": "2024-02-15", "from_date": "2024-01-01", "to_date": "2024-04-30" } headers = { "Authorization": ".", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```typescript import { SayariClient } from "sayari"; const sayari = new SayariClient({ clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET" }); await sayari.attributes.postAttribute({ entity: "zq04axX2dLn9tE6W6Q8Qhg", type: "address", value: { "street1": "1600 Pennsylvania Avenue NW", "city": "Washington DC", "state": "Washington DC", "postalCode": "20500", "country": "US" }, toDate: "2024-04-30", fromDate: "2024-01-01", date: "2024-02-15" }); ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.sayari.com/v1/attribute" payload := strings.NewReader("{\n \"entity\": \"zq04axX2dLn9tE6W6Q8Qhg\",\n \"type\": \"address\",\n \"value\": {\n \"street1\": \"1600 Pennsylvania Avenue NW\",\n \"city\": \"Washington DC\",\n \"state\": \"Washington DC\",\n \"postalCode\": \"20500\",\n \"country\": \"US\"\n },\n \"date\": \"2024-02-15\",\n \"from_date\": \"2024-01-01\",\n \"to_date\": \"2024-04-30\"\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/attribute") 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 \"entity\": \"zq04axX2dLn9tE6W6Q8Qhg\",\n \"type\": \"address\",\n \"value\": {\n \"street1\": \"1600 Pennsylvania Avenue NW\",\n \"city\": \"Washington DC\",\n \"state\": \"Washington DC\",\n \"postalCode\": \"20500\",\n \"country\": \"US\"\n },\n \"date\": \"2024-02-15\",\n \"from_date\": \"2024-01-01\",\n \"to_date\": \"2024-04-30\"\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/attribute") .header("Authorization", ".") .header("Content-Type", "application/json") .body("{\n \"entity\": \"zq04axX2dLn9tE6W6Q8Qhg\",\n \"type\": \"address\",\n \"value\": {\n \"street1\": \"1600 Pennsylvania Avenue NW\",\n \"city\": \"Washington DC\",\n \"state\": \"Washington DC\",\n \"postalCode\": \"20500\",\n \"country\": \"US\"\n },\n \"date\": \"2024-02-15\",\n \"from_date\": \"2024-01-01\",\n \"to_date\": \"2024-04-30\"\n}") .asString(); ``` ```php request('POST', 'https://api.sayari.com/v1/attribute', [ 'body' => '{ "entity": "zq04axX2dLn9tE6W6Q8Qhg", "type": "address", "value": { "street1": "1600 Pennsylvania Avenue NW", "city": "Washington DC", "state": "Washington DC", "postalCode": "20500", "country": "US" }, "date": "2024-02-15", "from_date": "2024-01-01", "to_date": "2024-04-30" }', 'headers' => [ 'Authorization' => '.', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.sayari.com/v1/attribute"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "."); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"entity\": \"zq04axX2dLn9tE6W6Q8Qhg\",\n \"type\": \"address\",\n \"value\": {\n \"street1\": \"1600 Pennsylvania Avenue NW\",\n \"city\": \"Washington DC\",\n \"state\": \"Washington DC\",\n \"postalCode\": \"20500\",\n \"country\": \"US\"\n },\n \"date\": \"2024-02-15\",\n \"from_date\": \"2024-01-01\",\n \"to_date\": \"2024-04-30\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": ".", "Content-Type": "application/json" ] let parameters = [ "entity": "zq04axX2dLn9tE6W6Q8Qhg", "type": "address", "value": [ "street1": "1600 Pennsylvania Avenue NW", "city": "Washington DC", "state": "Washington DC", "postalCode": "20500", "country": "US" ], "date": "2024-02-15", "from_date": "2024-01-01", "to_date": "2024-04-30" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.sayari.com/v1/attribute")! 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() ```