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

# Create

> Attaches an external resource to an incident.

You must provide a resource with resource_type and either external_id or url, but not both.

When providing a url, the server will create the attachment from that link for the given resource type if the integration is installed and the link is valid.

To attach an arbitrary link that isn't backed by an integration, use the arbitrary_url resource type with a url, and optionally a title and emoji.

🔑 Requires the `attachments.create` scope.


## OpenAPI

````yaml /openapi/tags/incident-attachments-v1.json post /v1/incident_attachments
openapi: 3.0.3
info:
  description: "This is the API reference for incident.io.\n\nIt documents available API endpoints, provides examples of how to use it, and\ninstructions around things like authentication and error handling.\n\nThe API is hosted at:\n\n- https://api.incident.io/\n\nAnd you will need to create an API key via your [incident.io\ndashboard](https://app.incident.io/settings/api-keys) to make requests.\n\n# Making requests\n\nHere are the key concepts required to make requests to the incident.io API.\n\n## Authentication\n\nFor all requests made to the incident.io API, you'll need an API key.\n\nTo create an API key, head to the incident dashboard and visit [API\nkeys](https://app.incident.io/settings/api-keys). When you create the key, you'll be able to choose what actions it\ncan take for your account: choose carefully, as those roles can only be set\nwhen you first create the key. We'll only show you the token once, so make sure\nyou store it somewhere safe.\n\nAPI keys are global to your incident.io account, and can be managed by anyone\nwho has the right permissions. We display the user that created the API key,\nand the API key will remain valid if that user becomes deactivated.\n\nOnce you have the key, you should make requests to the API that set the\n`Authorization` request header using a \"Bearer\" authentication scheme:\n\n```\nAuthorization: Bearer <YOUR_API_KEY>\n```\n\n## Rate Limits\n\nThe incident.io API enforces rate limits to ensure consistent performance for all users.\n\nThe default rate limit is 1200 requests/minute per API key. This limit applies to most endpoints across the API.\n\nLimits are token buckets that refill continuously rather than resetting on a fixed window boundary. The default\nbucket holds 1200 requests and refills at 20 per second, so you can burst up to the full bucket and then sustain\n20 requests/second indefinitely. There is no boundary at which your quota resets to full in one step.\n\nSome endpoints have lower rate limits, particularly those that interact with external third-party systems that impose\ntheir own limitations. These specific limits vary by endpoint.\n\n### Rate limit headers\n\nResponses to requests authenticated with an API key carry your current allowance, so you can pace yourself rather\nthan waiting to be throttled:\n\n```\nX-RateLimit-Limit: 60, 1200;window=60, 60;window=60\nX-RateLimit-Remaining: 59\nX-RateLimit-Used: 1\nX-RateLimit-Reset: 1785173199\n```\n\n| Header | Meaning |\n| --- | --- |\n| `X-RateLimit-Limit` | The quota that binds this request, followed by every limit that applied and the window it applies over |\n| `X-RateLimit-Remaining` | Requests you can make right now against the binding limit |\n| `X-RateLimit-Used` | Requests you have spent against it |\n| `X-RateLimit-Reset` | Unix timestamp (seconds) at which that limit will be back to full |\n\nMore than one limit can apply to a request: your API key's overall limit, and for some endpoints a lower limit of\ntheir own. `X-RateLimit-Limit` lists all of them, each with its window, so `1200;window=60` means 1200 requests per\nminute. Because our limits refill continuously rather than resetting on a boundary, that window is what tells you\nthe rate you can sustain: 1200 per 60 seconds is 20 requests/second indefinitely.\n\n`Remaining`, `Used` and `Reset` describe whichever limit has the least allowance left, since that is the one you\nwill hit first.\n\n`X-RateLimit-Remaining` may lag by a small number of requests under high concurrency, and can move by more than the\nrequests you made, because limits scoped to your whole organisation are shared with your other API keys.\n\nHeaders are omitted rather than guessed if we cannot determine your allowance for a request.\n\n### Exceeding a rate limit\n\nWhen you exceed a rate limit the API responds with `429 Too Many Requests` and a `Retry-After` header giving the\nnumber of seconds to wait:\n\n```\nX-RateLimit-Limit: 1200, 1200;window=60\nX-RateLimit-Remaining: 0\nX-RateLimit-Used: 1200\nX-RateLimit-Reset: 1785173199\nRetry-After: 1\n```\n\nPrefer `Retry-After` over `X-RateLimit-Reset` when deciding how long to back off. `Retry-After` is when a single\nrequest will succeed; `X-RateLimit-Reset` is the later point at which your whole allowance has returned. It is a\nduration rather than a timestamp, so it does not depend on your clock agreeing with ours.\n\nThe 429 also carries a JSON body with the same information:\n\n```json\n{\n    \"type\": \"too_many_requests\",\n    \"status\": 429,\n    \"request_id\": \"b839a403-7704-41c1-bf6a-39a2d68caefa\",\n    \"rate_limit\": {\n        \"name\": \"api_key_name\",\n        \"limit\": 1200,\n        \"remaining\": 0,\n        \"retry_after\": \"2025-04-17T11:17:18Z\"\n    },\n    \"errors\": [\n        {\n            \"code\": \"too_many_requests\",\n            \"message\": \"Too many requests hit the API too quickly. We recommend an exponential backoff of your requests.\"\n        }\n    ]\n}\n```\n\nThe response includes:\n* The name of the API key (`name`)\n* The bucket limit (`limit`)\n* The number of requests remaining (`remaining`)\n* When you can retry requests (`retry_after`), as an RFC3339 timestamp\n\n## Errors\n\nWe use standard HTTP response codes to indicate the status or failure of API\nrequests.\n\nThe API response body will be JSON, and contain more detailed information on the\nnature of the error.\n\nAn example error when a request is made without an API key:\n\n```json\n{\n  \"type\": \"authentication_error\",\n  \"status\": 401,\n  \"request_id\": \"8e3cc412-b49d-4957-9073-2c19d2c61804\",\n  \"errors\": [\n    {\n      \"code\": \"missing_authorization_material\",\n      \"message\": \"No authorization material provided in request\"\n    }\n  ]\n}\n```\n\nNote that the error:\n\n- Contains the HTTP status (`401`)\n- References the type of error (`authentication_error`)\n- Includes a `request_id` that can be provided to incident.io support to help\n\tdebug questions with your API request\n- Provides a list of individual errors, which go into detail about why the error\n\toccurred\n\nThe most common error will be a 422 Validation Error, which is returned when the\nrequest was rejected due to failing validations.\n\nThese errors look like this:\n\n```json\n{\n  \"type\": \"validation_error\",\n  \"status\": 422,\n  \"request_id\": \"631766c4-4afd-4803-997c-cd700928fa4b\",\n  \"errors\": [\n    {\n      \"code\": \"is_required\",\n      \"message\": \"A severity is required to open an incident\",\n      \"source\": {\n        \"field\": \"severity_id\"\n      }\n    }\n  ]\n}\n```\n\nThis error is caused by not providing a severity identifier, which should be at\nthe `severity_id` field of the request payload. Errors like these can be mapped to\nforms, should you be integrating with the API from a user-interface.\n\n## Compatibility\n\nWe won't make breaking changes to existing API services or endpoints, but will\nexpect integrators to upgrade themselves to the latest API endpoints within 3\nmonths of us deprecating the old service.\n\nWe will make changes that are considered backwards compatible, which include:\n\n- Adding new API endpoints and services\n- Adding new properties to responses from existing API endpoints\n- Reordering properties returned from existing API endpoints\n- Adding optional request parameters to existing API endpoints\n- Altering the format or length of IDs\n- Adding new values to enums\n\nIt is important that clients are robust to these changes, to ensure reliable\nintegrations.\n\nAs an example, if you are generating a client using an openapi-generator, ensure\nthe generated client is configured to support unknown enum values, often\nconfigured via the `enumUnknownDefaultCase` parameter.\n\nWhen breaking changes are unavoidable, we'll create a new service version on a\nseparate path, and run them in parallel.\n\nFor example:\n\n- https://api.incident.io/v1/incidents\n- https://api.incident.io/v2/incidents\n\nFor any questions, email support@incident.io.\n"
  title: incident.io
  version: 1.0.0
servers:
  - url: https://api.incident.io
security:
  - BearerAuth: []
tags:
  - description: >
      Create, list and delete incident attachments.


      Incident Attachments allows you to connect resources from external systems
      into incidents.

      Examples include: PagerDuty incidents and GitHub pull requests.
    name: Incident Attachments V1
paths:
  /v1/incident_attachments:
    post:
      tags:
        - Incident Attachments V1
      summary: Create
      description: >-
        Attaches an external resource to an incident.


        You must provide a resource with resource_type and either external_id or
        url, but not both.


        When providing a url, the server will create the attachment from that
        link for the given resource type if the integration is installed and the
        link is valid.


        To attach an arbitrary link that isn't backed by an integration, use the
        arbitrary_url resource type with a url, and optionally a title and
        emoji.
      operationId: Incident Attachments V1_Create
      requestBody:
        content:
          application/json:
            example:
              incident_id: 01FDAG4SAP5TYPT98WGR2N7W91
              resource:
                emoji: rocket
                external_id: '123'
                resource_type: pager_duty_incident
                title: Impact tracking spreadsheet
                url: https://github.com/company/repo/pull/123
            schema:
              $ref: '#/components/schemas/IncidentAttachmentsCreatePayloadV1'
        required: true
      responses:
        '201':
          content:
            application/json:
              example:
                incident_attachment:
                  id: 01FCNDV6P870EA6S7TK1DSYD5H
                  incident_id: 01FCNDV6P870EA6S7TK1DSYD5H
                  resource:
                    external_id: '123'
                    permalink: https://my.pagerduty.com/incidents/ABC
                    resource_type: pager_duty_incident
                    title: The database has gone down
              schema:
                $ref: '#/components/schemas/IncidentAttachmentsCreateResultV1'
          description: Created response.
components:
  schemas:
    IncidentAttachmentsCreatePayloadV1:
      example:
        incident_id: 01FDAG4SAP5TYPT98WGR2N7W91
        resource:
          emoji: rocket
          external_id: '123'
          resource_type: pager_duty_incident
          title: Impact tracking spreadsheet
          url: https://github.com/company/repo/pull/123
      properties:
        incident_id:
          description: ID of the incident to add an attachment to
          example: 01FDAG4SAP5TYPT98WGR2N7W91
          type: string
        resource:
          example:
            emoji: rocket
            external_id: '123'
            resource_type: pager_duty_incident
            title: Impact tracking spreadsheet
            url: https://github.com/company/repo/pull/123
          properties:
            emoji:
              description: >-
                Emoji shortcode representing the link, without surrounding
                colons. Only supported for the arbitrary_url resource type.
              example: rocket
              type: string
            external_id:
              description: ID of the resource in the external system
              example: '123'
              type: string
            resource_type:
              description: 'E.g. PagerDuty: the external system that holds the resource'
              enum:
                - pager_duty_incident
                - opsgenie_alert
                - datadog_monitor_alert
                - github_pull_request
                - gitlab_merge_request
                - sentry_issue
                - jira_issue
                - jsm_alert
                - atlassian_statuspage_incident
                - zendesk_ticket
                - google_calendar_event
                - outlook_calendar_event
                - slack_file
                - salesforce_case
                - arbitrary_url
                - scrubbed
                - statuspage_incident
              example: pager_duty_incident
              type: string
            title:
              description: >-
                Human readable title for the link. Only supported for the
                arbitrary_url resource type.
              example: Impact tracking spreadsheet
              type: string
            url:
              description: >-
                URL of the external resource to attach for the given resource
                type.
              example: https://github.com/company/repo/pull/123
              type: string
          required:
            - resource_type
          type: object
      required:
        - incident_id
        - resource
      type: object
    IncidentAttachmentsCreateResultV1:
      example:
        incident_attachment:
          id: 01FCNDV6P870EA6S7TK1DSYD5H
          incident_id: 01FCNDV6P870EA6S7TK1DSYD5H
          resource:
            external_id: '123'
            permalink: https://my.pagerduty.com/incidents/ABC
            resource_type: pager_duty_incident
            title: The database has gone down
      properties:
        incident_attachment:
          $ref: '#/components/schemas/IncidentAttachmentV1'
      required:
        - incident_attachment
      type: object
    IncidentAttachmentV1:
      properties:
        id:
          description: Unique identifier of this incident membership
          example: 01FCNDV6P870EA6S7TK1DSYD5H
          type: string
        incident_id:
          description: Unique identifier of the incident
          example: 01FCNDV6P870EA6S7TK1DSYD5H
          type: string
        resource:
          $ref: '#/components/schemas/ExternalResourceV1'
      required:
        - id
        - incident_id
        - resource
      type: object
    ExternalResourceV1:
      example:
        external_id: '123'
        permalink: https://my.pagerduty.com/incidents/ABC
        resource_type: pager_duty_incident
        title: The database has gone down
      properties:
        external_id:
          description: ID of the resource in the external system
          example: '123'
          type: string
        permalink:
          description: URL of the resource
          example: https://my.pagerduty.com/incidents/ABC
          type: string
        resource_type:
          description: 'E.g. PagerDuty: the external system that holds the resource'
          enum:
            - pager_duty_incident
            - opsgenie_alert
            - datadog_monitor_alert
            - github_pull_request
            - gitlab_merge_request
            - sentry_issue
            - jira_issue
            - jsm_alert
            - atlassian_statuspage_incident
            - zendesk_ticket
            - google_calendar_event
            - outlook_calendar_event
            - slack_file
            - salesforce_case
            - arbitrary_url
            - scrubbed
            - statuspage_incident
          example: pager_duty_incident
          type: string
        title:
          description: Title of resource
          example: The database has gone down
          type: string
      required:
        - permalink
        - external_id
        - title
        - resource_type
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key from your incident.io dashboard (Settings → API keys)

````