> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mangrovesystems.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create evidence on event

> Adds evidence to an event. This is also how a source document is attached to a static input: pass the static input's `active_event_id` as `event_id`. An item whose `type` does not match the data it carries, such as `file` with only `link`, is skipped, and a request with no usable items returns 201 with an empty `data` array. Send either `file` or `link` in an item, not both. Requires the `read:project` and `write:event` token scopes.



## OpenAPI

````yaml POST /projects/{project_id}/events/{event_id}/evidences
openapi: 3.1.0
info:
  title: Mangrove - API
  version: 1.1.0
  description: >
    ## Filtering and sorting


    List endpoints that accept `filter` take one query parameter per condition,
    written `filter[field][comparator]=value`, for example
    `filter[name][contains]=North`. The comparators are `eq`, `neq`, `gt`,
    `geq`, `lt`, `leq` and `contains`, and `filter[field]=value` is short for
    `eq`. Conditions combine with AND. `contains` matches part of the value, is
    case-sensitive, and applies only to text fields. An unknown field or
    comparator, a value that doesn't fit the field's type, or a list or object
    as the value returns 400 with a message naming the problem. Each list
    operation names its filterable fields; some take only `eq`, and say so.


    `sort` takes a comma-separated list of fields, for example
    `sort=-created_at,name`. Each field sorts ascending, or descending with a
    `-` prefix. Unknown sort fields are ignored. Sorting by `id` orders by the
    record's internal ID, not its friendly ID. Each list operation names its
    sortable fields.
servers:
  - url: https://app.gomangrove.com/api/v1
security:
  - sec0: []
paths:
  /projects/{project_id}/events/{event_id}/evidences:
    post:
      summary: Add evidence to an event
      description: >-
        Adds evidence to an event. This is also how a source document is
        attached to a static input: pass the static input's `active_event_id` as
        `event_id`. An item whose `type` does not match the data it carries,
        such as `file` with only `link`, is skipped, and a request with no
        usable items returns 201 with an empty `data` array. Send either `file`
        or `link` in an item, not both. Requires the `read:project` and
        `write:event` token scopes.
      operationId: create-evidence
      parameters:
        - $ref: '#/components/parameters/ProjectId'
        - name: event_id
          in: path
          schema:
            type: string
          required: true
          description: >-
            The event's friendly ID (e.g. `evt_aBcD1234eFgH5678`). A static
            input's `active_event_id` is also accepted; static events are not
            returned by GET /projects/{project_id}/events.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                evidences:
                  type: array
                  items:
                    type: object
                    required:
                      - type
                      - data
                    properties:
                      type:
                        type: string
                        description: Type of evidence.
                        enum:
                          - file
                          - url
                      data:
                        type: object
                        description: Evidence data, structure depends on the type.
                        properties:
                          file:
                            type: object
                            description: >-
                              Required when `type` is `file`. The decoded file
                              can be at most 50 MB, and its content type must be
                              one of the accepted types. The content type is
                              identified from the file's bytes. The declared
                              `type`, then the file name's extension, decide it
                              when the bytes are not recognized, or when they
                              name a more specific form of the detected format,
                              such as an xlsx spreadsheet within a zip
                              container. Accepted content types: `image/png`,
                              `image/jpg`, `image/jpeg`, `application/pdf`,
                              `application/vnd.ms-excel` (xls),
                              `application/vnd.ms-excel.sheet.macroEnabled.12`
                              (xlsm),
                              `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`
                              (xlsx), `application/msword` (doc),
                              `application/vnd.openxmlformats-officedocument.wordprocessingml.document`
                              (docx), `application/zip`, `application/json`,
                              `application/geo+json`, `text/plain`, `text/csv`,
                              `video/mp4`, `video/quicktime` (mov) and
                              `video/x-msvideo` (avi). A file that breaks either
                              rule returns 422.
                            required:
                              - name
                              - type
                              - base64
                            properties:
                              name:
                                type: string
                                description: Name of the file
                              type:
                                type: string
                                description: MIME type of the file
                              base64:
                                type: string
                                description: >-
                                  Base64-encoded file content. A data URI prefix
                                  such as `data:application/pdf;base64,` is
                                  accepted.
                          link:
                            type: object
                            description: Required when `type` is `url`.
                            required:
                              - url
                            properties:
                              name:
                                type: string
                                description: Name of the URL evidence. Defaults to the URL.
                              url:
                                type: string
                                description: URL string
                      data_point_ids:
                        type: array
                        description: >-
                          The friendly IDs (e.g. `in_aBcD1234eFgH5678`) of data
                          points on this event to attach this evidence to. When
                          omitted or empty, the evidence is attached to one of
                          the event's data points that has a value, so the event
                          must have one.
                        items:
                          type: string
            examples:
              File Example:
                value:
                  evidences:
                    - type: file
                      data:
                        file:
                          name: receipt.pdf
                          type: application/pdf
                          base64: <base64-encoded-content>
                      data_point_ids:
                        - in_aBcD1234eFgH5678
                    - type: url
                      data:
                        link:
                          url: https://www.example.com/delivery-ticket
                          name: Delivery ticket
              URL Example:
                value:
                  evidences:
                    - type: url
                      data:
                        link:
                          name: Delivery ticket
                          url: https://www.example.com/delivery-ticket
                      data_point_ids:
                        - in_aBcD1234eFgH5678
                        - in_dEfG5678hIjK9012
      responses:
        '201':
          description: The evidence created, in request order.
          content:
            application/json:
              example:
                data:
                  - id: ev_aBcD1234eFgH5678
                    url: >-
                      https://app.gomangrove.com/rails/active_storage/blobs/redirect/SIGNED_ID/receipt.pdf?disposition=attachment
                    evidence_type: file
                    name: receipt.pdf
                    data_point_ids:
                      - in_aBcD1234eFgH5678
                  - id: ev_dEfG5678hIjK9012
                    url: https://www.example.com/delivery-ticket
                    evidence_type: url
                    name: Delivery ticket
                    data_point_ids:
                      - in_aBcD1234eFgH5678
                      - in_dEfG5678hIjK9012
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/EventEvidence'
        '400':
          description: The body is not valid JSON.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: >-
            The project or event does not exist or the token cannot see it, or a
            `data_point_ids` entry is not a data point on this event.
          content:
            application/json:
              examples:
                Unknown data point:
                  value:
                    errors:
                      - message: 'Data point not found: in_dOesNotExist0000'
                Unknown project or event:
                  value:
                    errors:
                      - message: Record not found
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: >-
            A file is larger than 50 MB or its content type is not accepted, or
            the project has no nexus config. No evidence in the request is
            saved. A rejected file carries code `validate_attachment_file_type`
            or `validate_attachment_file_size`; branch on `code`.
          content:
            application/json:
              examples:
                File type not accepted:
                  value:
                    errors:
                      - message: >-
                          Nexus data points nexus evidences attachment must be a
                          valid file type (png, jpg, jpeg, pdf, xls, xlsx, xlsm,
                          doc, docx, zip, json, geojson, txt, csv, mp4, mov,
                          avi)
                        field: nexus_data_points.nexus_evidences.attachment
                        code: validate_attachment_file_type
                File too large:
                  value:
                    errors:
                      - message: >-
                          Nexus data points nexus evidences attachment file size
                          must be less than 50 MB
                        field: nexus_data_points.nexus_evidences.attachment
                        code: validate_attachment_file_size
                No configuration:
                  value:
                    errors:
                      - message: Project does not have Nexus configuration
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  parameters:
    ProjectId:
      name: project_id
      in: path
      required: true
      description: The project's friendly ID (e.g. `prj_aBcD1234eFgH5678`).
      schema:
        type: string
  schemas:
    EventEvidence:
      description: An evidence as the event's evidence endpoints return it.
      allOf:
        - $ref: '#/components/schemas/Evidence'
        - type: object
          properties:
            data_point_ids:
              type: array
              description: >-
                The friendly IDs of the data points on this event the evidence
                is attached to.
              items:
                type: string
    ErrorResponse:
      type: object
      required:
        - errors
      properties:
        errors:
          type: array
          items:
            type: object
            required:
              - message
            properties:
              message:
                type: string
                description: Human-readable error message
              field:
                type: string
                description: Attribute the error applies to (validation errors only)
              code:
                type: string
                description: Machine-readable error code (validation errors only)
              blocking:
                type: array
                description: >-
                  Bounded preview of the records blocking a destroy
                  (blocked-destroy errors only)
                items:
                  $ref: '#/components/schemas/DeletionBlockingRecord'
              blocking_count:
                type: integer
                description: >-
                  Total count of records blocking a destroy (blocked-destroy
                  errors only)
              config_key:
                type: string
                description: >-
                  The data feed source config setting to fix, when the error is
                  on `config` (data feed source validation errors only)
              count:
                type: number
                description: >-
                  The limit or comparison value the failed validation checked
                  against, e.g. a maximum length or a numeric bound (validation
                  errors only, when the validation has one)
              value:
                description: >-
                  The rejected value, e.g. on an inclusion or uniqueness failure
                  (validation errors only, when the validation reports one)
    Evidence:
      type: object
      properties:
        id:
          type: string
          description: The evidence's friendly ID (e.g. `ev_aBcD1234eFgH5678`).
          example: ev_aBcD1234eFgH5678
        url:
          type:
            - string
            - 'null'
          description: >-
            For `file` evidence, a download link on the Mangrove app host.
            Anyone holding the link can download the file without an API token;
            the link does not expire and keeps working after the token that
            fetched it is revoked. For `url` evidence, the URL as submitted.
            Other types carry a link Mangrove generated, or null.
          example: >-
            https://app.gomangrove.com/rails/active_storage/blobs/redirect/SIGNED_ID/receipt.pdf?disposition=attachment
        evidence_type:
          type: string
          enum:
            - file
            - url
            - library
            - api
            - record
            - excel_workbook
            - olca_pathway
          description: >-
            Evidence added through this API is `file` or `url`. The other types
            are generated by Mangrove.
        name:
          type:
            - string
            - 'null'
          description: >-
            Display name. A file's name, or a link's `name`, falling back to its
            URL.
          example: receipt.pdf
    DeletionBlockingRecord:
      type: object
      required:
        - type
      properties:
        type:
          type: string
        friendly_id:
          type: string
        name:
          type:
            - string
            - 'null'
          description: >-
            Display label, and the only identifier for records that have no
            friendly_id
  responses:
    Unauthorized:
      description: >-
        The API token is missing, invalid or expired. The body is empty, except
        for an expired token, which returns the error below.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            errors:
              - message: API token has expired
    Forbidden:
      description: >-
        The token lacks the scope the operation's description names, or a
        condition the description states applies, such as a feature that isn't
        enabled for your account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            errors:
              - message: You are not authorized to perform this action
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: Authorization
      x-bearer-format: ''

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.