# Add Email Batch Recipients

`POST /v1/email/batches/{batch_id}/recipients`

Append rows to a batch; a drafted batch resumes. Duplicates are skipped and reported.

If the latest send is a finished send of every row, it reopens and mails the new drafts.

Authenticate with `Authorization: Bearer $TALQING_API_KEY`. Errors use the shared envelope: https://docs.talqing.com/api-reference/errors.md

## OpenAPI

```json
{
 "openapi":"3.1.0",
 "servers":[
  {
   "description":"Talqing API",
   "url":"https://api.talqing.com"
  }
 ],
 "paths":{
  "/v1/email/batches/{batch_id}/recipients":{
   "post":{
    "description":"Append rows to a batch; a drafted batch resumes. Duplicates are skipped and reported.\n\nIf the latest send is a finished send of every row, it reopens and mails the new drafts.",
    "operationId":"email.batches.recipients.add",
    "parameters":[
     {
      "in":"path",
      "name":"batch_id",
      "required":true,
      "schema":{
       "format":"uuid",
       "title":"Batch Id",
       "type":"string"
      }
     }
    ],
    "requestBody":{
     "content":{
      "application/json":{
       "schema":{
        "$ref":"#/components/schemas/AddEmailRecipientsRequest"
       }
      }
     },
     "required":true
    },
    "responses":{
     "200":{
      "content":{
       "application/json":{
        "schema":{
         "$ref":"#/components/schemas/AddEmailRecipientsResponse"
        }
       }
      },
      "description":"Successful Response"
     },
     "400":{
      "$ref":"#/components/responses/BadRequest"
     },
     "401":{
      "$ref":"#/components/responses/Unauthorized"
     },
     "403":{
      "$ref":"#/components/responses/Forbidden"
     },
     "404":{
      "$ref":"#/components/responses/NotFound"
     },
     "409":{
      "$ref":"#/components/responses/Conflict"
     },
     "422":{
      "$ref":"#/components/responses/ValidationFailed"
     },
     "default":{
      "$ref":"#/components/responses/Error"
     }
    },
    "security":[
     {
      "BearerAuth":[]
     },
     {
      "SessionCookie":[]
     }
    ],
    "summary":"Add Email Batch Recipients",
    "tags":[
     "email"
    ]
   }
  }
 },
 "components":{
  "responses":{
   "BadRequest":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"Well-formed, but rejected by a rule; `detail.errors` lists each problem."
   },
   "Conflict":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"The resource's current state forbids this \u2014 a name already taken, a job already running."
   },
   "Error":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"Unexpected error. Every error this API returns carries this body."
   },
   "Forbidden":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"Authenticated, but this organization role may not perform the operation."
   },
   "NotFound":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"No such resource in this organization."
   },
   "Unauthorized":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"Missing credential, or one that is revoked or no longer a member of this organization."
   },
   "ValidationFailed":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"The request did not match this operation's schema; `detail.errors` lists each field."
   }
  },
  "schemas":{
   "AddEmailRecipientsRequest":{
    "additionalProperties":false,
    "properties":{
     "recipients":{
      "items":{
       "$ref":"#/components/schemas/EmailRecipientInput"
      },
      "maxItems":10000,
      "minItems":1,
      "title":"Recipients",
      "type":"array"
     }
    },
    "required":[
     "recipients"
    ],
    "title":"AddEmailRecipientsRequest",
    "type":"object"
   },
   "AddEmailRecipientsResponse":{
    "description":"`standing_send_id` is the send of every row that will mail the new rows\nwithout review, or null when they wait for review.",
    "properties":{
     "added":{
      "title":"Added",
      "type":"integer"
     },
     "skipped":{
      "items":{
       "$ref":"#/components/schemas/SkippedEmailRecipient"
      },
      "title":"Skipped",
      "type":"array"
     },
     "standing_send_id":{
      "anyOf":[
       {
        "format":"uuid",
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Standing Send Id"
     },
     "total_recipients":{
      "title":"Total Recipients",
      "type":"integer"
     }
    },
    "required":[
     "added",
     "skipped",
     "total_recipients",
     "standing_send_id"
    ],
    "title":"AddEmailRecipientsResponse",
    "type":"object"
   },
   "EmailRecipientInput":{
    "additionalProperties":false,
    "description":"One row of the uploaded list.\n\n``input`` is one CSV row, keyed by header, values kept as strings \u2014\ninferring types turns a \"007\" prefix into 7. It is handed to the task\nverbatim as its ``{{vars.*}}`` values.",
    "properties":{
     "input":{
      "additionalProperties":{
       "type":"string"
      },
      "title":"Input",
      "type":"object"
     }
    },
    "title":"EmailRecipientInput",
    "type":"object"
   },
   "ErrorBody":{
    "description":"The structured half of our error contract: a human `message` plus a list\nof individual `errors` (used wherever we surface many problems at once,\nincluding tool publish, op-tree checks, and request validation). The global\nexception handlers normalize every API error to\n`{detail: {message, errors, code}}`, so SDKs can parse one shape consistently.",
    "properties":{
     "code":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "default":null,
      "description":"A stable identifier for this error, when it has one.",
      "title":"Code"
     },
     "errors":{
      "items":{
       "type":"string"
      },
      "title":"Errors",
      "type":"array"
     },
     "message":{
      "title":"Message",
      "type":"string"
     }
    },
    "required":[
     "message",
     "errors"
    ],
    "title":"ErrorBody",
    "type":"object"
   },
   "ErrorResponse":{
    "description":"The body of every error response, at every status code.",
    "properties":{
     "detail":{
      "$ref":"#/components/schemas/ErrorBody"
     }
    },
    "required":[
     "detail"
    ],
    "title":"ErrorResponse",
    "type":"object"
   },
   "SkippedEmailRecipient":{
    "description":"A row of the request that will not be drafted. `row_number` is its 1-based\nposition in the request; `recipient_id` is null when it was not stored.",
    "properties":{
     "reason":{
      "title":"Reason",
      "type":"string"
     },
     "recipient_id":{
      "anyOf":[
       {
        "format":"uuid",
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Recipient Id"
     },
     "row_number":{
      "title":"Row Number",
      "type":"integer"
     }
    },
    "required":[
     "row_number",
     "reason",
     "recipient_id"
    ],
    "title":"SkippedEmailRecipient",
    "type":"object"
   }
  }
 }
}
```
