---
swagger: "2.0"
info:
  description: Allows users to manage Webhook subscriptions to a number of distinct topics. Possible list of topics - https://www.shipwire.com/w/developers/webhooks-guide/'
  version: "3.0"
  title: Shipwire Webhooks API
host: api.shipwire.com
basePath: /
schemes:
- https
consumes:
- application/json
produces:
- application/json
security:
- basicAuth: []
paths:
  /api/v3/webhooks:
    get:
      tags:
      - Webhooks
      summary: List all active subscriptions
      description: List all active subscriptions
      operationId: ApiV3WebhooksGet
      produces:
      - application/json
      parameters: []
      responses:
        200:
          description: OK
          schema:
            $ref: '#/definitions/ListAllWebhooksResponse'
    post:
      tags:
      - Webhooks
      summary: Create a subscription to a topic
      description: Create a subscription to a topic
      operationId: ApiV3WebhooksPost
      produces:
      - application/json
      parameters:
      - in: body
        name: body
        description: ""
        required: true
        schema:
          $ref: '#/definitions/CreateASubscriptionRequest'
      responses:
        200:
          description: OK
          schema:
            $ref: '#/definitions/CreateASubscriptionResponse'
  /api/v3/webhooks/{id}:
    get:
      tags:
      - Webhooks
      summary: Retrieve a Subscription
      description: Get a single subscription
      operationId: ApiV3WebhooksByIdGet
      produces:
      - application/json
      parameters:
      - name: id
        in: path
        description: Unique autogenerated id for a webhook subscription
        required: true
        type: integer
      responses:
        200:
          description: OK
          schema:
            $ref: '#/definitions/RetrieveAWebhookResponse'
    put:
      tags:
      - Webhooks
      summary: Update a subscription
      description: Update a subscription
      operationId: ApiV3WebhooksByIdPut
      produces:
      - application/json
      parameters:
      - name: id
        in: path
        description: Unique autogenerated id for a webhook subscription
        required: true
        type: integer
      - in: body
        name: body
        description: ""
        required: true
        schema:
          $ref: '#/definitions/UpdateASubscriptionRequest'
      responses:
        200:
          description: OK
          schema:
            $ref: '#/definitions/UpdateASubscriptionResponse'
    delete:
      tags:
      - Webhooks
      summary: Remove a subscription
      description: Delete a webhook subscription
      operationId: ApiV3WebhooksByIdDelete
      produces:
      - application/json
      parameters:
      - name: id
        in: path
        description: Unique autogenerated id for a webhook subscription
        required: true
        type: integer
      responses:
        200:
          description: OK
          schema:
            $ref: '#/definitions/RemoveSubscriptionResponse'
  /api/v3/secret:
    get:
      tags:
      - Webhooks
      summary: List all secrets
      description: So that applications can validate the authenticity of events, Shipwire can optionally sign events with a shared secret. This resource gets all active secrets.
      operationId: ApiV3SecretGet
      produces:
      - application/json
      parameters: []
      responses:
        200:
          description: OK
          schema:
            $ref: '#/definitions/ListAllSecretsResponse'
    post:
      tags:
      - Webhooks
      summary: Create a secret
      description: Create a new secret
      operationId: ApiV3SecretPost
      produces:
      - application/json
      parameters: []
      responses:
        200:
          description: OK
          schema:
            $ref: '#/definitions/CreateASecretResponse'
  /api/v3/secret/{id}:
    get:
      tags:
      - Webhooks
      summary: Retrieve a secret
      description: Get a single secret
      operationId: ApiV3SecretByIdGet
      produces:
      - application/json
      parameters:
      - name: id
        in: path
        description: Unique autogenerated id for a webhook secret
        required: true
        type: integer
      responses:
        200:
          description: OK
          schema:
            $ref: '#/definitions/RetrieveASecretResponse'
    delete:
      tags:
      - Webhooks
      summary: Remove a secret
      description: Delete a secret
      operationId: ApiV3SecretByIdDelete
      produces:
      - application/json
      parameters:
      - name: id
        in: path
        description: Unique autogenerated id for a webhook secret
        required: true
        type: integer
      responses:
        200:
          description: OK
          schema:
            $ref: '#/definitions/RemoveSecretResponse'
securityDefinitions:
  basicAuth:
    type: basic
definitions:
  ListAllWebhooksResponse:
    title: List All Subscriptions Response
    allOf:
    - $ref: '#/definitions/ResponseModel'
    - {}
  CreateASubscriptionRequest:
    title: Create a Subscription Request
    allOf:
    - $ref: '#/definitions/WebhookRequest'
    - {}
  CreateASubscriptionResponse:
    title: Create a Subscription Response
    allOf:
    - $ref: '#/definitions/ResponseModel'
    - {}
  RetrieveAWebhookResponse:
    title: Retrieve a Subscription Response
    allOf:
    - $ref: '#/definitions/ResponseModelID'
    - {}
  UpdateASubscriptionRequest:
    title: Update a Subscription Request
    allOf:
    - $ref: '#/definitions/WebhookRequest'
    - {}
  UpdateASubscriptionResponse:
    title: Update a Subscription Response
    allOf:
    - $ref: '#/definitions/ResponseModelID'
    - {}
  RemoveSubscriptionResponse:
    title: Remove subscription response
    allOf:
    - $ref: '#/definitions/ResponseModelNull'
    - {}
  ListAllSecretsResponse:
    title: List All Secrets Response
    allOf:
    - $ref: '#/definitions/ResponseModelSecret'
    - {}
  CreateASecretResponse:
    title: Create a Secret Response
    allOf:
    - $ref: '#/definitions/ResponseModelSecretID'
    - {}
  RetrieveASecretResponse:
    title: Retrieve a Secret Response
    allOf:
    - $ref: '#/definitions/ResponseModelSecretID'
    - {}
  RemoveSecretResponse:
    title: Remove secret response
    allOf:
    - $ref: '#/definitions/ResponseModelNull'
    - {}
  WebhookResponse:
    type: object
    properties:
      offset:
        type: integer
        example: 0
        description: This is an integer that matches the offset given in the request and dictates the number of items to skip while fetching results. For example, there is a preset limit of 20 results per page. If there are 30 total results and offset is set to 20, then the response will show the second "page" of results, with items 21 to 30.
      total:
        type: integer
        example: 1
        description: Total number of available items in the API response.
      previous:
        type: string
        example: null
        description: A link used to fetch the previous set or page of items in the API response.
      next:
        type: string
        example: null
        description: A link used to fetch the next set or page of items in the API response.
      items:
        type: array
        items:
          $ref: '#/definitions/WebhookResponse_items'
    title: Subscription Information
    description: ""
  WebhookResponseItems:
    properties:
      id:
        type: integer
        example: 921
        description: Unique Subscription ID
      topic:
        type: string
        example: v1.product.created
        description: A topic is a distinct stream of messages corresponding to a type of event in Shipwire system ex. order.created. Possible list of topics - https://www.shipwire.com/w/developers/webhooks-guide/
      url:
        type: string
        example: https://example.com/
        description: A user provided https based URL where webhook bodies will be POSTed by Shipwire system
    title: Subscription Items Response
  WebhookRequest:
    type: object
    required:
    - topic
    - url
    properties:
      topic:
        type: string
        example: v1.product.created
        description: A topic is a distinct stream of messages corresponding to a type of event in Shipwire system ex. order.created. Possible list of topics - https://www.shipwire.com/w/developers/webhooks-guide/
        minLength: 1
        maxLength: 255
        pattern: /^(?:v([0-9]+)\\.)?(.*)$/
      url:
        type: string
        example: https://example.com/
        description: A user provided https based URL where webhook bodies will be POSTed by Shipwire system
        minLength: 1
        maxLength: 2083
      authType:
        type: string
        example: Basic
        description: ""
      authHeader:
        type: string
        example: Basic dGVzdHNo...Y29tOmhlbWExMjM0
        description: ""
  WebhookSecretResponse:
    properties:
      id:
        type: integer
        example: 921
        description: Unique ID of secret question
      secret:
        type: string
        example: 9d573f...6015c
        description: Secret Key
      expiration:
        type: string
        example: 2018-05-13 23:43:37
        description: Expiration Timestamp
    title: Subscription Secret Response
  ResponseModel:
    allOf:
    - $ref: '#/definitions/StatusMessageModel'
    - {}
  ResponseModelID:
    allOf:
    - $ref: '#/definitions/StatusMessageModel'
    - {}
  ResponseModelNull:
    allOf:
    - $ref: '#/definitions/StatusMessageModel'
    - {}
  ResponseModelSecret:
    allOf:
    - $ref: '#/definitions/StatusMessageModel'
    - {}
  ResponseModelSecretID:
    allOf:
    - $ref: '#/definitions/StatusMessageModel'
    - {}
  StatusMessageModel:
    type: object
    properties:
      status:
        type: integer
        example: 200
        description: This is the HTTP status code.
      message:
        type: string
        example: Successful
        description: This is the HTTP status message.
  WebhookResponse_items:
    properties:
      resourceLocation:
        type: string
        example: https://api.shipwire.com/api/v3/webhooks/921
        description: A URL that gives more information about the linked resource. A 'null' value would mean that no further information is available for that resource. Use this resource to get detailed information about the stock available.
      resource:
        $ref: '#/definitions/WebhookResponseItems'
